initial
This commit is contained in:
1171
node_modules/pug-strip-comments/test/__snapshots__/index.test.js.snap
generated
vendored
Normal file
1171
node_modules/pug-strip-comments/test/__snapshots__/index.test.js.snap
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
26
node_modules/pug-strip-comments/test/cases/comments-in-case.input.json
generated
vendored
Normal file
26
node_modules/pug-strip-comments/test/cases/comments-in-case.input.json
generated
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
{"type":"doctype","line":1,"val":"html"}
|
||||
{"type":"newline","line":2}
|
||||
{"type":"tag","line":2,"val":"html","selfClosing":false}
|
||||
{"type":"indent","line":3,"val":2}
|
||||
{"type":"tag","line":3,"val":"body","selfClosing":false}
|
||||
{"type":"indent","line":4,"val":3}
|
||||
{"type":"code","line":4,"val":"var s = 'this'","escape":false,"buffer":false}
|
||||
{"type":"newline","line":5}
|
||||
{"type":"case","line":5,"val":"s"}
|
||||
{"type":"indent","line":6,"val":5}
|
||||
{"type":"comment","line":6,"val":" Comment","buffer":false}
|
||||
{"type":"newline","line":7}
|
||||
{"type":"when","line":7,"val":"'this'"}
|
||||
{"type":"indent","line":8,"val":7}
|
||||
{"type":"tag","line":8,"val":"p","selfClosing":false}
|
||||
{"type":"text","line":8,"val":"It's this!"}
|
||||
{"type":"outdent","line":9}
|
||||
{"type":"when","line":9,"val":"'that'"}
|
||||
{"type":"indent","line":10,"val":7}
|
||||
{"type":"tag","line":10,"val":"p","selfClosing":false}
|
||||
{"type":"text","line":10,"val":"It's that!"}
|
||||
{"type":"outdent","line":10}
|
||||
{"type":"outdent","line":10}
|
||||
{"type":"outdent","line":10}
|
||||
{"type":"outdent","line":10}
|
||||
{"type":"eos","line":10}
|
||||
76
node_modules/pug-strip-comments/test/cases/comments.input.json
generated
vendored
Normal file
76
node_modules/pug-strip-comments/test/cases/comments.input.json
generated
vendored
Normal file
@@ -0,0 +1,76 @@
|
||||
{"type":"newline","line":2}
|
||||
{"type":"comment","line":2,"val":" foo","buffer":true}
|
||||
{"type":"newline","line":3}
|
||||
{"type":"tag","line":3,"val":"ul","selfClosing":false}
|
||||
{"type":"indent","line":4,"val":2}
|
||||
{"type":"comment","line":4,"val":" bar","buffer":true}
|
||||
{"type":"newline","line":5}
|
||||
{"type":"tag","line":5,"val":"li","selfClosing":false}
|
||||
{"type":"text","line":5,"val":"one"}
|
||||
{"type":"newline","line":6}
|
||||
{"type":"comment","line":6,"val":" baz","buffer":true}
|
||||
{"type":"newline","line":7}
|
||||
{"type":"tag","line":7,"val":"li","selfClosing":false}
|
||||
{"type":"text","line":7,"val":"two"}
|
||||
{"type":"outdent","line":9}
|
||||
{"type":"comment","line":9,"val":"","buffer":true}
|
||||
{"type":"start-pipeless-text","line":9}
|
||||
{"type":"text","line":10,"val":"ul"}
|
||||
{"type":"newline","line":11}
|
||||
{"type":"text","line":11,"val":" li foo"}
|
||||
{"type":"newline","line":12}
|
||||
{"type":"text","line":12,"val":""}
|
||||
{"type":"end-pipeless-text","line":12}
|
||||
{"type":"newline","line":13}
|
||||
{"type":"comment","line":13,"val":" block","buffer":true}
|
||||
{"type":"start-pipeless-text","line":13}
|
||||
{"type":"text","line":14,"val":"// inline follow"}
|
||||
{"type":"newline","line":15}
|
||||
{"type":"text","line":15,"val":"li three"}
|
||||
{"type":"newline","line":16}
|
||||
{"type":"text","line":16,"val":""}
|
||||
{"type":"end-pipeless-text","line":16}
|
||||
{"type":"newline","line":17}
|
||||
{"type":"comment","line":17,"val":" block","buffer":true}
|
||||
{"type":"start-pipeless-text","line":17}
|
||||
{"type":"text","line":18,"val":"// inline followed by tags"}
|
||||
{"type":"newline","line":19}
|
||||
{"type":"text","line":19,"val":"ul"}
|
||||
{"type":"newline","line":20}
|
||||
{"type":"text","line":20,"val":" li four"}
|
||||
{"type":"newline","line":21}
|
||||
{"type":"text","line":21,"val":""}
|
||||
{"type":"end-pipeless-text","line":21}
|
||||
{"type":"newline","line":22}
|
||||
{"type":"comment","line":22,"val":"if IE lt 9","buffer":true}
|
||||
{"type":"start-pipeless-text","line":22}
|
||||
{"type":"text","line":23,"val":"// inline"}
|
||||
{"type":"newline","line":24}
|
||||
{"type":"text","line":24,"val":"script(src='/lame.js')"}
|
||||
{"type":"newline","line":25}
|
||||
{"type":"text","line":25,"val":"// end-inline"}
|
||||
{"type":"newline","line":26}
|
||||
{"type":"text","line":26,"val":""}
|
||||
{"type":"end-pipeless-text","line":26}
|
||||
{"type":"newline","line":27}
|
||||
{"type":"comment","line":27,"val":"","buffer":false}
|
||||
{"type":"text","line":28,"val":""}
|
||||
{"type":"start-pipeless-text","line":28}
|
||||
{"type":"text","line":29,"val":"asfd"}
|
||||
{"type":"newline","line":30}
|
||||
{"type":"text","line":30,"val":""}
|
||||
{"type":"end-pipeless-text","line":30}
|
||||
{"type":"newline","line":31}
|
||||
{"type":"comment","line":31,"val":"","buffer":false}
|
||||
{"type":"newline","line":32}
|
||||
{"type":"text","line":32,"val":" "}
|
||||
{"type":"newline","line":33}
|
||||
{"type":"text","line":33,"val":"asfd"}
|
||||
{"type":"newline","line":35}
|
||||
{"type":"tag","line":35,"val":"p","selfClosing":false}
|
||||
{"type":"text","line":35,"val":"five"}
|
||||
{"type":"newline","line":37}
|
||||
{"type":"class","line":37,"val":"foo"}
|
||||
{"type":"text","line":37,"val":"// not a comment"}
|
||||
{"type":"newline","line":38}
|
||||
{"type":"eos","line":38}
|
||||
19
node_modules/pug-strip-comments/test/cases/comments.source.input.json
generated
vendored
Normal file
19
node_modules/pug-strip-comments/test/cases/comments.source.input.json
generated
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
{"type":"comment","line":1,"val":"","buffer":false}
|
||||
{"type":"start-pipeless-text","line":1}
|
||||
{"type":"text","line":2,"val":"s/s."}
|
||||
{"type":"newline","line":3}
|
||||
{"type":"text","line":3,"val":""}
|
||||
{"type":"end-pipeless-text","line":3}
|
||||
{"type":"newline","line":4}
|
||||
{"type":"comment","line":4,"val":" test/cases/comments.source.pug","buffer":false}
|
||||
{"type":"text","line":5,"val":""}
|
||||
{"type":"newline","line":6}
|
||||
{"type":"comment","line":6,"val":"","buffer":false}
|
||||
{"type":"start-pipeless-text","line":6}
|
||||
{"type":"text","line":7,"val":"test/cases/comments.source.pug"}
|
||||
{"type":"newline","line":8}
|
||||
{"type":"text","line":8,"val":"when"}
|
||||
{"type":"newline","line":9}
|
||||
{"type":"text","line":9,"val":"()"}
|
||||
{"type":"end-pipeless-text","line":9}
|
||||
{"type":"eos","line":9}
|
||||
3
node_modules/pug-strip-comments/test/errors/comment-in-comment.input.json
generated
vendored
Normal file
3
node_modules/pug-strip-comments/test/errors/comment-in-comment.input.json
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
{"type":"comment","line":1,"val":"","buffer":false}
|
||||
{"type":"comment","line":2,"val":"","buffer":false}
|
||||
{"type":"eos","line":3}
|
||||
4
node_modules/pug-strip-comments/test/errors/end.input.json
generated
vendored
Normal file
4
node_modules/pug-strip-comments/test/errors/end.input.json
generated
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
{"type":"comment","line":1,"val":"","buffer":false}
|
||||
{"type":"end-pipeless-text","line":4}
|
||||
{"type":"newline","line":4}
|
||||
{"type":"eos","line":5}
|
||||
6
node_modules/pug-strip-comments/test/errors/startstart.input.json
generated
vendored
Normal file
6
node_modules/pug-strip-comments/test/errors/startstart.input.json
generated
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
{"type":"comment","line":1,"val":"","buffer":false}
|
||||
{"type":"start-pipeless-text","line":2}
|
||||
{"type":"start-pipeless-text","line":3}
|
||||
{"type":"end-pipeless-text","line":4}
|
||||
{"type":"newline","line":4}
|
||||
{"type":"eos","line":5}
|
||||
51
node_modules/pug-strip-comments/test/index.test.js
generated
vendored
Normal file
51
node_modules/pug-strip-comments/test/index.test.js
generated
vendored
Normal file
@@ -0,0 +1,51 @@
|
||||
'use strict';
|
||||
|
||||
var fs = require('fs');
|
||||
var assert = require('assert');
|
||||
var lineJSON = require('line-json');
|
||||
var strip = require('../');
|
||||
|
||||
var dir = __dirname + '/cases/';
|
||||
fs.readdirSync(dir).forEach(function (testCase) {
|
||||
if (/\.input\.json$/.test(testCase)) {
|
||||
test(testCase, function () {
|
||||
var stem = testCase.replace(/\.input\.json$/, '.');
|
||||
|
||||
function test (name, options) {
|
||||
var input = fs.readFileSync(dir + testCase, 'utf8');
|
||||
input = lineJSON.parse(input);
|
||||
|
||||
var result = strip(input, options);
|
||||
expect(result).toMatchSnapshot();
|
||||
}
|
||||
|
||||
test('unbuffered');
|
||||
test('buffered', { stripBuffered: true, stripUnbuffered: false });
|
||||
test('both', { stripBuffered: true });
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
var edir = __dirname + '/errors/';
|
||||
fs.readdirSync(edir).forEach(function (testCase) {
|
||||
if (/\.input\.json$/.test(testCase)) {
|
||||
test(testCase, function () {
|
||||
var stem = testCase.replace(/\.input\.json$/, '.');
|
||||
|
||||
var input = fs.readFileSync(edir + testCase, 'utf8');
|
||||
input = lineJSON.parse(input);
|
||||
|
||||
try {
|
||||
strip(input);
|
||||
throw new Error('Expected ' + testCase + ' to throw an exception.');
|
||||
} catch (ex) {
|
||||
if (!ex || !ex.code || !ex.code.indexOf('PUG:') === 0) throw ex;
|
||||
expect({
|
||||
msg: ex.msg,
|
||||
code: ex.code,
|
||||
line: ex.line
|
||||
}).toMatchSnapshot();
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
Reference in New Issue
Block a user