diff options
author | RabsRincon <rubrinbla@gmail.com> | 2018-01-18 19:43:10 +0100 |
---|---|---|
committer | RabsRincon <rubrinbla@gmail.com> | 2018-01-18 19:43:10 +0100 |
commit | a54faefb4c8668d9c9f93c78bd6bc639d1f0c219 (patch) | |
tree | 6465bf3e1d8e270cc53e67c04277c5773b16f7d6 /lib/compilers/fake-for-test.js | |
parent | 7bd30b4c4b10f93f26db81fbbe492149b8d487eb (diff) | |
download | compiler-explorer-a54faefb4c8668d9c9f93c78bd6bc639d1f0c219.tar.gz compiler-explorer-a54faefb4c8668d9c9f93c78bd6bc639d1f0c219.zip |
ES6fy compilers inheritance
Diffstat (limited to 'lib/compilers/fake-for-test.js')
-rw-r--r-- | lib/compilers/fake-for-test.js | 38 |
1 files changed, 26 insertions, 12 deletions
diff --git a/lib/compilers/fake-for-test.js b/lib/compilers/fake-for-test.js index e698a9366..4ac03c4b1 100644 --- a/lib/compilers/fake-for-test.js +++ b/lib/compilers/fake-for-test.js @@ -24,22 +24,36 @@ const _ = require('underscore-node'); -module.exports = (info, env) => { - return { - compiler: { +class FakeCompiler { + constructor(info) { + this.compiler = { id: info.id || 'fake-for-test', - lang: info.lang || 'fake-lang' - }, - getInfo: () => null, - getDefaultFilters: () => [], - getRemote: () => null, - compile: (source, options, backendOptions, filters) => Promise.resolve(_.extend(info.fakeResult || {}, { + lang: info.lang || 'fake-lang', + options: info.options || '' + }; + this.info = info; + } + + getInfo() { + return null; + } + getDefaultFilters() { + return []; + } + getRemote() { + return null; + } + compile(source, options, backendOptions, filters) { + return Promise.resolve(_.extend(this.info.fakeResult || {}, { input: { source: source, options: options, backendOptions: backendOptions, filters: filters } - })) - }; -};
\ No newline at end of file + })); + } +} + + +module.exports = FakeCompiler;
\ No newline at end of file |