RabsRincon | d74c528 | 2018-03-08 12:55:31 +0100 | [diff] [blame] | 1 | // Copyright (c) 2018, Rubén Rincón |
| 2 | // All rights reserved. |
| 3 | // |
| 4 | // Redistribution and use in source and binary forms, with or without |
| 5 | // modification, are permitted provided that the following conditions are met: |
| 6 | // |
| 7 | // * Redistributions of source code must retain the above copyright notice, |
| 8 | // this list of conditions and the following disclaimer. |
| 9 | // * Redistributions in binary form must reproduce the above copyright |
| 10 | // notice, this list of conditions and the following disclaimer in the |
| 11 | // documentation and/or other materials provided with the distribution. |
| 12 | // |
| 13 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
| 14 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
| 15 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
| 16 | // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE |
| 17 | // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
| 18 | // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
| 19 | // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
| 20 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
Austin Morton | de85aec | 2020-09-27 00:20:19 -0400 | [diff] [blame] | 21 | // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
RabsRincon | d74c528 | 2018-03-08 12:55:31 +0100 | [diff] [blame] | 22 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
| 23 | // POSSIBILITY OF SUCH DAMAGE. |
| 24 | |
Austin Morton | 044dcfb | 2020-09-26 16:59:26 -0400 | [diff] [blame] | 25 | import { DMDCompiler } from '../lib/compilers/dmd'; |
| 26 | import { LDCCompiler } from '../lib/compilers/ldc'; |
RabsRincon | d74c528 | 2018-03-08 12:55:31 +0100 | [diff] [blame] | 27 | |
Austin Morton | 044dcfb | 2020-09-26 16:59:26 -0400 | [diff] [blame] | 28 | import { makeCompilationEnvironment } from './utils'; |
RabsRincon | d74c528 | 2018-03-08 12:55:31 +0100 | [diff] [blame] | 29 | |
Rubén | 1a33902 | 2018-06-19 10:09:44 +0200 | [diff] [blame] | 30 | const languages = { |
Rubén Rincón Blanco | ccff4b9 | 2020-08-04 22:39:02 +0200 | [diff] [blame] | 31 | d: {id: 'd'}, |
Rubén | 1a33902 | 2018-06-19 10:09:44 +0200 | [diff] [blame] | 32 | }; |
| 33 | |
RabsRincon | d74c528 | 2018-03-08 12:55:31 +0100 | [diff] [blame] | 34 | describe('D', () => { |
Austin Morton | 1b7fe24 | 2020-02-18 00:03:15 -0500 | [diff] [blame] | 35 | let ce; |
RabsRincon | d74c528 | 2018-03-08 12:55:31 +0100 | [diff] [blame] | 36 | const info = { |
| 37 | exe: null, |
| 38 | remote: true, |
Rubén Rincón Blanco | ccff4b9 | 2020-08-04 22:39:02 +0200 | [diff] [blame] | 39 | lang: languages.d.id, |
RabsRincon | d74c528 | 2018-03-08 12:55:31 +0100 | [diff] [blame] | 40 | }; |
| 41 | |
Austin Morton | 1b7fe24 | 2020-02-18 00:03:15 -0500 | [diff] [blame] | 42 | before(() => { |
Austin Morton | cadbdf5 | 2020-03-07 01:50:49 -0500 | [diff] [blame] | 43 | ce = makeCompilationEnvironment({languages}); |
Austin Morton | 1b7fe24 | 2020-02-18 00:03:15 -0500 | [diff] [blame] | 44 | }); |
| 45 | |
RabsRincon | d74c528 | 2018-03-08 12:55:31 +0100 | [diff] [blame] | 46 | it('LDC should not allow -run parameter', () => { |
| 47 | const compiler = new LDCCompiler(info, ce); |
Rubén Rincón Blanco | ccff4b9 | 2020-08-04 22:39:02 +0200 | [diff] [blame] | 48 | compiler.filterUserOptions(['hello', '-run', '--something']).should.deep.equal(['hello', '--something']); |
RabsRincon | d74c528 | 2018-03-08 12:55:31 +0100 | [diff] [blame] | 49 | }); |
| 50 | it('DMD should not allow -run parameter', () => { |
| 51 | const compiler = new DMDCompiler(info, ce); |
Rubén Rincón Blanco | ccff4b9 | 2020-08-04 22:39:02 +0200 | [diff] [blame] | 52 | compiler.filterUserOptions(['hello', '-run', '--something']).should.deep.equal(['hello', '--something']); |
RabsRincon | d74c528 | 2018-03-08 12:55:31 +0100 | [diff] [blame] | 53 | }); |
Johan Engelen | 85482c2 | 2018-03-19 23:33:04 +0100 | [diff] [blame] | 54 | |
| 55 | it('LDC supports AST output since version 1.4.0', () => { |
| 56 | const compiler = new LDCCompiler(info, ce); |
Rubén Rincón Blanco | ccff4b9 | 2020-08-04 22:39:02 +0200 | [diff] [blame] | 57 | compiler.couldSupportASTDump('LDC - the LLVM D compiler (1.3.0)').should.equal(false); |
| 58 | compiler.couldSupportASTDump('LDC - the LLVM D compiler (1.4.0)').should.equal(true); |
| 59 | compiler.couldSupportASTDump('LDC - the LLVM D compiler (1.8.0git-d54d25b-dirty)').should.equal(true); |
| 60 | compiler.couldSupportASTDump('LDC - the LLVM D compiler (1.10.0)').should.equal(true); |
Johan Engelen | 85482c2 | 2018-03-19 23:33:04 +0100 | [diff] [blame] | 61 | }); |
RabsRincon | d74c528 | 2018-03-08 12:55:31 +0100 | [diff] [blame] | 62 | }); |