aboutsummaryrefslogtreecommitdiff
path: root/test/compilers/argument-parsers-tests.js
diff options
context:
space:
mode:
authorRabsRincon <rubrinbla@gmail.com>2018-01-18 19:43:10 +0100
committerRabsRincon <rubrinbla@gmail.com>2018-01-18 19:43:10 +0100
commita54faefb4c8668d9c9f93c78bd6bc639d1f0c219 (patch)
tree6465bf3e1d8e270cc53e67c04277c5773b16f7d6 /test/compilers/argument-parsers-tests.js
parent7bd30b4c4b10f93f26db81fbbe492149b8d487eb (diff)
downloadcompiler-explorer-a54faefb4c8668d9c9f93c78bd6bc639d1f0c219.tar.gz
compiler-explorer-a54faefb4c8668d9c9f93c78bd6bc639d1f0c219.zip
ES6fy compilers inheritance
Diffstat (limited to 'test/compilers/argument-parsers-tests.js')
-rw-r--r--test/compilers/argument-parsers-tests.js30
1 files changed, 14 insertions, 16 deletions
diff --git a/test/compilers/argument-parsers-tests.js b/test/compilers/argument-parsers-tests.js
index 1660baca1..bc1e5bfb3 100644
--- a/test/compilers/argument-parsers-tests.js
+++ b/test/compilers/argument-parsers-tests.js
@@ -23,7 +23,7 @@
// POSSIBILITY OF SUCH DAMAGE.
const chai = require('chai'),
- Compile = require('../../lib/base-compiler'),
+ FakeCompiler = require('../../lib/compilers/fake-for-test'),
CompilationEnvironment = require('../../lib/compilation-env').CompilationEnvironment,
chaiAsPromised = require("chai-as-promised"),
parsers = require('../../lib/compilers/argument-parsers');
@@ -34,38 +34,36 @@ chai.should();
function makeCompiler(stdout, stderr, code) {
if (code === undefined) code = 0;
const env = new CompilationEnvironment((key, def) => def);
- const compiler = new Compile({'lang': 'c++', 'remote': true}, env);
- compiler.exec = () => {
- return Promise.resolve({code: code, stdout: stdout || "", stderr: stderr || ""});
- };
+ const compiler = new FakeCompiler({lang: 'c++', remote: true}, env);
+ compiler.exec = () => Promise.resolve({code: code, stdout: stdout || "", stderr: stderr || ""});
return compiler;
}
describe('option parser', () => {
it('should handle empty options', () => {
- return parsers.getOptions(makeCompiler()).should.eventually.deep.equals({});
+ return parsers.Base.getOptions(makeCompiler()).should.eventually.deep.equals({});
});
it('should parse single-dash options', () => {
- return parsers.getOptions(makeCompiler("-foo\n")).should.eventually.deep.equals({'-foo': true});
+ return parsers.Base.getOptions(makeCompiler("-foo\n")).should.eventually.deep.equals({'-foo': true});
});
it('should parse double-dash options', () => {
- return parsers.getOptions(makeCompiler("--foo\n")).should.eventually.deep.equals({'--foo': true});
+ return parsers.Base.getOptions(makeCompiler("--foo\n")).should.eventually.deep.equals({'--foo': true});
});
it('should parse stderr options', () => {
- return parsers.getOptions(makeCompiler("", "--bar=monkey\n")).should.eventually.deep.equals({'--bar': true});
+ return parsers.Base.getOptions(makeCompiler("", "--bar=monkey\n")).should.eventually.deep.equals({'--bar': true});
});
it('handles non-option text', () => {
- return parsers.getOptions(makeCompiler("-foo=123\nthis is a fish\n-badger=123")).should.eventually.deep.equals(
+ return parsers.Base.getOptions(makeCompiler("-foo=123\nthis is a fish\n-badger=123")).should.eventually.deep.equals(
{'-foo': true, '-badger': true});
});
it('should ignore if errors occur', () => {
- return parsers.getOptions(makeCompiler("--foo\n", "--bar\n", 1)).should.eventually.deep.equals({});
+ return parsers.Base.getOptions(makeCompiler("--foo\n", "--bar\n", 1)).should.eventually.deep.equals({});
});
});
describe('gcc parser', () => {
it('should handle empty options', () => {
- return parsers.gcc(makeCompiler()).should.eventually.satisfy(result => {
+ return new parsers.GCC(makeCompiler()).should.eventually.satisfy(result => {
return Promise.all([
result.compiler.supportsGccDump.should.equals(true),
result.compiler.options.should.equals('')
@@ -73,7 +71,7 @@ describe('gcc parser', () => {
});
});
it('should handle options', () => {
- return parsers.gcc(makeCompiler("-masm=intel\n-fdiagnostics-color=[blah]"))
+ return new parsers.GCC(makeCompiler("-masm=intel\n-fdiagnostics-color=[blah]"))
.should.eventually.satisfy(result => {
return Promise.all([
result.compiler.supportsGccDump.should.equals(true),
@@ -84,7 +82,7 @@ describe('gcc parser', () => {
});
});
it('should handle undefined options', () => {
- return parsers.gcc(makeCompiler("-fdiagnostics-color=[blah]")).should.eventually.satisfy(result => {
+ return new parsers.GCC(makeCompiler("-fdiagnostics-color=[blah]")).should.eventually.satisfy(result => {
return Promise.all([
result.compiler.supportsGccDump.should.equals(true),
result.compiler.options.should.equals('-fdiagnostics-color=always')
@@ -95,14 +93,14 @@ describe('gcc parser', () => {
describe('clang parser', () => {
it('should handle empty options', () => {
- return parsers.clang(makeCompiler()).should.eventually.satisfy(result => {
+ return new parsers.Clang(makeCompiler()).should.eventually.satisfy(result => {
return Promise.all([
result.compiler.options.should.equals('')
]);
});
});
it('should handle options', () => {
- return parsers.clang(makeCompiler("-fsave-optimization-record\n-fcolor-diagnostics"))
+ return new parsers.Clang(makeCompiler("-fsave-optimization-record\n-fcolor-diagnostics"))
.should.eventually.satisfy(result => {
return Promise.all([
result.compiler.supportsOptOutput.should.equals(true),