diff --git a/tests/run.js b/tests/run.js index 6449ea6..f721d02 100644 --- a/tests/run.js +++ b/tests/run.js @@ -12,3 +12,4 @@ require('./test_07_02.js'); require('./test_08.js'); require('./test_09_01.js'); require('./test_09_02.js'); +require('./test_12.js'); diff --git a/tests/samples/issue10_include.js b/tests/samples/issue10_include.js new file mode 100644 index 0000000..eebf6db --- /dev/null +++ b/tests/samples/issue10_include.js @@ -0,0 +1,4 @@ +// #ifndef TEST +// #define var TEST=true +console.log('test'); +// #endif diff --git a/tests/samples/issue10_main.js b/tests/samples/issue10_main.js new file mode 100644 index 0000000..f55e549 --- /dev/null +++ b/tests/samples/issue10_main.js @@ -0,0 +1,3 @@ +// #include "issue10_include.js" +console.log('testing include'); +// #include "issue10_include.js" diff --git a/tests/test_12.js b/tests/test_12.js new file mode 100644 index 0000000..7d7b75b --- /dev/null +++ b/tests/test_12.js @@ -0,0 +1,14 @@ +/* eslint no-console: 0 */ + +var test = require('tape'); + +var Preprocessor = require(__dirname + '/../Preprocessor.js'); +var fs = require('fs'); + +test('test_12:issue10', function(t) { + var pp = new Preprocessor(fs.readFileSync(__dirname + '/samples/issue10_main.js'), __dirname + '/samples'); + var src = pp.process({}, console.log).replace(/\r/g, ''); + t.equal(src, "console.log('test');\nconsole.log('testing include');\n"); + + t.end(); +});