Initial commit

This commit is contained in:
Developer
2025-04-21 16:03:20 +02:00
commit 2832896157
22874 changed files with 3092801 additions and 0 deletions

View File

@@ -0,0 +1,4 @@
var s = `a
b
c`;
assert.equal(s, 'a\n b\n c');

View File

@@ -0,0 +1,6 @@
/* jshint esnext:true */
assert.strictEqual(
`a${1}b${`${1+1}c`}3`,
'a1b2c3'
);

View File

@@ -0,0 +1,2 @@
var s = `str`;
assert.equal(s, 'str');

View File

@@ -0,0 +1,6 @@
function r(strings) {
assert.equal(strings.raw[0], '\\n');
return strings.raw.join('');
}
assert.equal(r `\n`, '\\n');

View File

@@ -0,0 +1,2 @@
var s = `1 + 1 = ${1 + 1}`;
assert.equal(s, '1 + 1 = 2');

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');

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;
});