This commit is contained in:
chrosey
2017-09-13 07:52:34 +02:00
parent a1f16c37f4
commit 2340b0226b
24621 changed files with 2912161 additions and 149 deletions
+4
View File
@@ -0,0 +1,4 @@
var s = `a
b
c`;
assert.equal(s, 'a\n b\n c');
+6
View File
@@ -0,0 +1,6 @@
/* jshint esnext:true */
assert.strictEqual(
`a${1}b${`${1+1}c`}3`,
'a1b2c3'
);
+2
View File
@@ -0,0 +1,2 @@
var s = `str`;
assert.equal(s, 'str');
@@ -0,0 +1,6 @@
function r(strings) {
assert.equal(strings.raw[0], '\\n');
return strings.raw.join('');
}
assert.equal(r `\n`, '\\n');
+2
View File
@@ -0,0 +1,2 @@
var s = `1 + 1 = ${1 + 1}`;
assert.equal(s, '1 + 1 = 2');
+26
View File
@@ -0,0 +1,26 @@
function tag(strings) {
var values = [].slice.call(arguments, 1);
assert.equal(strings[0], 'a');
assert.equal(strings[1], 'b');
assert.equal(values[0], 42);
return 'whatever';
}
assert.equal(tag `a${ 42 }b`, 'whatever');
function tagInterpolateFirst(strings) {
var values = [].slice.call(arguments, 1);
assert.equal(strings[0], '');
assert.equal(strings[1], 'b');
assert.equal(values[0], 42);
return 'whatever';
}
assert.equal(tagInterpolateFirst `${ 42 }b`, 'whatever');
function tagInterpolateLast(strings) {
var values = [].slice.call(arguments, 1);
assert.equal(strings[0], 'a');
assert.equal(strings[1], '');
assert.equal(values[0], 42);
return 'whatever';
}
assert.equal(tagInterpolateLast `a${ 42 }`, 'whatever');
+27
View File
@@ -0,0 +1,27 @@
/**
* We pull in example files from test/examples/*.js. Write your assertions in
* the file alongside the ES6 class "setup" code. The node `assert` library
* will already be in the context.
*/
Error.stackTraceLimit = 20;
var compile = require('../lib').compile;
var fs = require('fs');
var path = require('path');
var RESULTS = 'test/results';
if (!fs.existsSync(RESULTS)) {
fs.mkdirSync(RESULTS);
}
require('example-runner').runCLI(function(source, testName, filename) {
var result = compile(source, {
includeRuntime: true,
sourceFileName: filename,
sourceMapName: filename + '.map'
});
fs.writeFileSync(path.join(RESULTS, testName + '.js'), result.code, 'utf8');
fs.writeFileSync(path.join(RESULTS, testName + '.js.map'), JSON.stringify(result.map), 'utf8');
return result.code;
});