From b708d609d0935a3cb7fdf474e26fbd8da882cb2c Mon Sep 17 00:00:00 2001 From: Marco Petersen Date: Tue, 10 Sep 2019 13:52:48 +0200 Subject: [PATCH] Add back HTML substate to tests --- src/twig/twig.test.ts | 444 +++++++++++++++++++++--------------------- 1 file changed, 222 insertions(+), 222 deletions(-) diff --git a/src/twig/twig.test.ts b/src/twig/twig.test.ts index c42318d6..327f0e30 100644 --- a/src/twig/twig.test.ts +++ b/src/twig/twig.test.ts @@ -8,7 +8,7 @@ import { testTokenization } from '../test/testRunner'; /** - * HTML Tests, without the html substate + * HTML Tests */ testTokenization(['twig', 'css', 'javascript'], [ @@ -16,8 +16,8 @@ testTokenization(['twig', 'css', 'javascript'], [ [{ line: '', tokens: [ - { startIndex: 0, type: 'delimiter' }, + { startIndex: 0, type: 'delimiter.html' }, { startIndex: 1, type: '' } ] }], @@ -53,8 +53,8 @@ testTokenization(['twig', 'css', 'javascript'], [ line: 'i ', tokens: [ - { startIndex: 0, type: 'delimiter' }, - { startIndex: 1, type: 'tag' }, - { startIndex: 4, type: 'delimiter' } + { startIndex: 0, type: 'delimiter.html' }, + { startIndex: 1, type: 'tag.html' }, + { startIndex: 4, type: 'delimiter.html' } ] }], @@ -90,10 +90,10 @@ testTokenization(['twig', 'css', 'javascript'], [ [{ line: '', tokens: [ - { startIndex: 0, type: 'delimiter' }, - { startIndex: 1, type: 'tag' }, + { startIndex: 0, type: 'delimiter.html' }, + { startIndex: 1, type: 'tag.html' }, { startIndex: 4, type: '' }, - { startIndex: 5, type: 'delimiter' } + { startIndex: 5, type: 'delimiter.html' } ] }], @@ -101,9 +101,9 @@ testTokenization(['twig', 'css', 'javascript'], [ [{ line: '', tokens: [ - { startIndex: 0, type: 'delimiter' }, - { startIndex: 1, type: 'tag' }, - { startIndex: 8, type: 'delimiter' } + { startIndex: 0, type: 'delimiter.html' }, + { startIndex: 1, type: 'tag.html' }, + { startIndex: 8, type: 'delimiter.html' } ] }], @@ -111,9 +111,9 @@ testTokenization(['twig', 'css', 'javascript'], [ [{ line: '', tokens: [ - { startIndex: 0, type: 'delimiter' }, - { startIndex: 2, type: 'tag' }, - { startIndex: 5, type: 'delimiter' } + { startIndex: 0, type: 'delimiter.html' }, + { startIndex: 2, type: 'tag.html' }, + { startIndex: 5, type: 'delimiter.html' } ] }], @@ -121,10 +121,10 @@ testTokenization(['twig', 'css', 'javascript'], [ [{ line: '', tokens: [ - { startIndex: 0, type: 'delimiter' }, - { startIndex: 2, type: 'tag' }, + { startIndex: 0, type: 'delimiter.html' }, + { startIndex: 2, type: 'tag.html' }, { startIndex: 5, type: '' }, - { startIndex: 7, type: 'delimiter' } + { startIndex: 7, type: 'delimiter.html' } ] }], @@ -132,10 +132,10 @@ testTokenization(['twig', 'css', 'javascript'], [ [{ line: '', tokens: [ - { startIndex: 0, type: 'delimiter' }, - { startIndex: 1, type: 'tag' }, + { startIndex: 0, type: 'delimiter.html' }, + { startIndex: 1, type: 'tag.html' }, { startIndex: 4, type: '' }, - { startIndex: 5, type: 'delimiter' } + { startIndex: 5, type: 'delimiter.html' } ] }], @@ -143,13 +143,13 @@ testTokenization(['twig', 'css', 'javascript'], [ [{ line: '', tokens: [ - { startIndex: 0, type: 'delimiter' }, - { startIndex: 1, type: 'tag' }, + { startIndex: 0, type: 'delimiter.html' }, + { startIndex: 1, type: 'tag.html' }, { startIndex: 7, type: '' }, - { startIndex: 8, type: 'attribute.name' }, - { startIndex: 12, type: 'delimiter' }, - { startIndex: 13, type: 'attribute.value' }, - { startIndex: 30, type: 'delimiter' }, + { startIndex: 8, type: 'attribute.name.html' }, + { startIndex: 12, type: 'delimiter.html' }, + { startIndex: 13, type: 'attribute.value.html' }, + { startIndex: 30, type: 'delimiter.html' }, { startIndex: 31, type: 'keyword.js' }, { startIndex: 34, type: '' }, { startIndex: 35, type: 'identifier.js' }, @@ -157,9 +157,9 @@ testTokenization(['twig', 'css', 'javascript'], [ { startIndex: 37, type: '' }, { startIndex: 38, type: 'number.js' }, { startIndex: 40, type: 'delimiter.js' }, - { startIndex: 41, type: 'delimiter' }, - { startIndex: 43, type: 'tag' }, - { startIndex: 49, type: 'delimiter' } + { startIndex: 41, type: 'delimiter.html' }, + { startIndex: 43, type: 'tag.html' }, + { startIndex: 49, type: 'delimiter.html' } ] }], @@ -167,13 +167,13 @@ testTokenization(['twig', 'css', 'javascript'], [ [{ line: '', tokens: [ - { startIndex: 0, type: 'delimiter' }, - { startIndex: 2, type: 'tag' }, - { startIndex: 8, type: 'delimiter' } + { startIndex: 0, type: 'delimiter.html' }, + { startIndex: 2, type: 'tag.html' }, + { startIndex: 8, type: 'delimiter.html' } ] }], @@ -199,13 +199,13 @@ testTokenization(['twig', 'css', 'javascript'], [ [{ line: '', tokens: [ - { startIndex: 0, type: 'delimiter' }, - { startIndex: 2, type: 'tag' }, - { startIndex: 8, type: 'delimiter' } + { startIndex: 0, type: 'delimiter.html' }, + { startIndex: 2, type: 'tag.html' }, + { startIndex: 8, type: 'delimiter.html' } ] }], @@ -228,13 +228,13 @@ testTokenization(['twig', 'css', 'javascript'], [ [{ line: '', @@ -246,9 +246,9 @@ testTokenization(['twig', 'css', 'javascript'], [ { startIndex: 6, type: '' }, { startIndex: 7, type: 'number.js' }, { startIndex: 9, type: 'delimiter.js' }, - { startIndex: 10, type: 'delimiter' }, - { startIndex: 12, type: 'tag' }, - { startIndex: 18, type: 'delimiter' } + { startIndex: 10, type: 'delimiter.html' }, + { startIndex: 12, type: 'tag.html' }, + { startIndex: 18, type: 'delimiter.html' } ] }], @@ -256,22 +256,22 @@ testTokenization(['twig', 'css', 'javascript'], [ [{ line: '', tokens: [ { startIndex: 0, type: '' }, - { startIndex: 2, type: 'delimiter' }, - { startIndex: 4, type: 'tag' }, - { startIndex: 10, type: 'delimiter' } + { startIndex: 2, type: 'delimiter.html' }, + { startIndex: 4, type: 'tag.html' }, + { startIndex: 10, type: 'delimiter.html' } ] }], @@ -279,20 +279,20 @@ testTokenization(['twig', 'css', 'javascript'], [ [{ line: '', tokens: [ - { startIndex: 0, type: 'delimiter' }, - { startIndex: 1, type: 'tag' }, - { startIndex: 7, type: 'delimiter' }, + { startIndex: 0, type: 'delimiter.html' }, + { startIndex: 1, type: 'tag.html' }, + { startIndex: 7, type: 'delimiter.html' }, { startIndex: 8, type: 'identifier.js' }, - { startIndex: 9, type: 'delimiter' }, - { startIndex: 11, type: 'tag' }, - { startIndex: 17, type: 'delimiter' }, - // { startIndex:18, type: 'delimiter' }, - { startIndex: 19, type: 'tag' }, - { startIndex: 25, type: 'delimiter' }, + { startIndex: 9, type: 'delimiter.html' }, + { startIndex: 11, type: 'tag.html' }, + { startIndex: 17, type: 'delimiter.html' }, + // { startIndex:18, type: 'delimiter.html' }, + { startIndex: 19, type: 'tag.html' }, + { startIndex: 25, type: 'delimiter.html' }, { startIndex: 26, type: 'identifier.js' }, - { startIndex: 27, type: 'delimiter' }, - { startIndex: 29, type: 'tag' }, - { startIndex: 35, type: 'delimiter' } + { startIndex: 27, type: 'delimiter.html' }, + { startIndex: 29, type: 'tag.html' }, + { startIndex: 35, type: 'delimiter.html' } ] }], @@ -300,16 +300,16 @@ testTokenization(['twig', 'css', 'javascript'], [ [{ line: '', tokens: [ - { startIndex: 0, type: 'delimiter' }, - { startIndex: 1, type: 'tag' }, + { startIndex: 0, type: 'delimiter.html' }, + { startIndex: 1, type: 'tag.html' }, { startIndex: 7, type: '' }, - { startIndex: 8, type: 'attribute.name' }, - { startIndex: 12, type: 'delimiter' }, - { startIndex: 13, type: 'attribute.value' }, - { startIndex: 30, type: 'delimiter' }, - // { startIndex:31, type: 'delimiter' }, - { startIndex: 33, type: 'tag' }, - { startIndex: 39, type: 'delimiter' } + { startIndex: 8, type: 'attribute.name.html' }, + { startIndex: 12, type: 'delimiter.html' }, + { startIndex: 13, type: 'attribute.value.html' }, + { startIndex: 30, type: 'delimiter.html' }, + // { startIndex:31, type: 'delimiter.html' }, + { startIndex: 33, type: 'tag.html' }, + { startIndex: 39, type: 'delimiter.html' } ] }], @@ -317,9 +317,9 @@ testTokenization(['twig', 'css', 'javascript'], [ [{ line: '', tokens: [ - { startIndex: 0, type: 'delimiter' }, - { startIndex: 1, type: 'tag' }, - { startIndex: 7, type: 'delimiter' }, + { startIndex: 0, type: 'delimiter.html' }, + { startIndex: 1, type: 'tag.html' }, + { startIndex: 7, type: 'delimiter.html' }, { startIndex: 8, type: 'keyword.js' }, { startIndex: 11, type: '' }, { startIndex: 12, type: 'identifier.js' }, @@ -327,9 +327,9 @@ testTokenization(['twig', 'css', 'javascript'], [ { startIndex: 14, type: '' }, { startIndex: 15, type: 'number.js' }, { startIndex: 17, type: 'delimiter.js' }, - { startIndex: 18, type: 'delimiter' }, - { startIndex: 20, type: 'tag' }, - { startIndex: 26, type: 'delimiter' } + { startIndex: 18, type: 'delimiter.html' }, + { startIndex: 20, type: 'tag.html' }, + { startIndex: 26, type: 'delimiter.html' } ] }], @@ -337,20 +337,20 @@ testTokenization(['twig', 'css', 'javascript'], [ [{ line: '', tokens: [ - { startIndex: 0, type: 'delimiter' }, - { startIndex: 1, type: 'tag' }, + { startIndex: 0, type: 'delimiter.html' }, + { startIndex: 1, type: 'tag.html' }, { startIndex: 7, type: '' }, - { startIndex: 8, type: 'attribute.name' }, - { startIndex: 12, type: 'delimiter' }, - { startIndex: 13, type: 'attribute.value' }, + { startIndex: 8, type: 'attribute.name.html' }, + { startIndex: 12, type: 'delimiter.html' }, + { startIndex: 13, type: 'attribute.value.html' }, { startIndex: 30, type: '' }, - { startIndex: 31, type: 'attribute.name' }, - { startIndex: 34, type: 'delimiter' }, - { startIndex: 35, type: 'attribute.value' }, - { startIndex: 44, type: 'delimiter' }, - // { startIndex:45, type: 'delimiter' }, - { startIndex: 47, type: 'tag' }, - { startIndex: 53, type: 'delimiter' } + { startIndex: 31, type: 'attribute.name.html' }, + { startIndex: 34, type: 'delimiter.html' }, + { startIndex: 35, type: 'attribute.value.html' }, + { startIndex: 44, type: 'delimiter.html' }, + // { startIndex:45, type: 'delimiter.html' }, + { startIndex: 47, type: 'tag.html' }, + { startIndex: 53, type: 'delimiter.html' } ] }], @@ -358,13 +358,13 @@ testTokenization(['twig', 'css', 'javascript'], [ [{ line: '', tokens: [ - { startIndex: 0, type: 'delimiter' }, - { startIndex: 1, type: 'tag' }, + { startIndex: 0, type: 'delimiter.html' }, + { startIndex: 1, type: 'tag.html' }, { startIndex: 4, type: '' }, - { startIndex: 5, type: 'attribute.name' }, - { startIndex: 8, type: 'delimiter' }, - { startIndex: 9, type: 'attribute.value' }, - { startIndex: 14, type: 'delimiter' } + { startIndex: 5, type: 'attribute.name.html' }, + { startIndex: 8, type: 'delimiter.html' }, + { startIndex: 9, type: 'attribute.value.html' }, + { startIndex: 14, type: 'delimiter.html' } ] }], @@ -372,13 +372,13 @@ testTokenization(['twig', 'css', 'javascript'], [ [{ line: '', tokens: [ - { startIndex: 0, type: 'delimiter' }, - { startIndex: 1, type: 'tag' }, + { startIndex: 0, type: 'delimiter.html' }, + { startIndex: 1, type: 'tag.html' }, { startIndex: 4, type: '' }, - { startIndex: 5, type: 'attribute.name' }, - { startIndex: 8, type: 'delimiter' }, - { startIndex: 9, type: 'attribute.value' }, - { startIndex: 14, type: 'delimiter' } + { startIndex: 5, type: 'attribute.name.html' }, + { startIndex: 8, type: 'delimiter.html' }, + { startIndex: 9, type: 'attribute.value.html' }, + { startIndex: 14, type: 'delimiter.html' } ] }], @@ -386,13 +386,13 @@ testTokenization(['twig', 'css', 'javascript'], [ [{ line: '', tokens: [ - { startIndex: 0, type: 'delimiter' }, - { startIndex: 1, type: 'tag' }, + { startIndex: 0, type: 'delimiter.html' }, + { startIndex: 1, type: 'tag.html' }, { startIndex: 4, type: '' }, - { startIndex: 5, type: 'attribute.name' }, - { startIndex: 8, type: 'delimiter' }, - { startIndex: 9, type: 'attribute.value' }, - { startIndex: 11, type: 'delimiter' } + { startIndex: 5, type: 'attribute.name.html' }, + { startIndex: 8, type: 'delimiter.html' }, + { startIndex: 9, type: 'attribute.value.html' }, + { startIndex: 11, type: 'delimiter.html' } ] }], @@ -400,17 +400,17 @@ testTokenization(['twig', 'css', 'javascript'], [ [{ line: '', tokens: [ - { startIndex: 0, type: 'delimiter' }, - { startIndex: 1, type: 'tag' }, + { startIndex: 0, type: 'delimiter.html' }, + { startIndex: 1, type: 'tag.html' }, { startIndex: 4, type: '' }, - { startIndex: 5, type: 'attribute.name' }, - { startIndex: 8, type: 'delimiter' }, - { startIndex: 9, type: 'attribute.value' }, + { startIndex: 5, type: 'attribute.name.html' }, + { startIndex: 8, type: 'delimiter.html' }, + { startIndex: 9, type: 'attribute.value.html' }, { startIndex: 14, type: '' }, - { startIndex: 15, type: 'attribute.name' }, - { startIndex: 18, type: 'delimiter' }, - { startIndex: 19, type: 'attribute.value' }, - { startIndex: 24, type: 'delimiter' } + { startIndex: 15, type: 'attribute.name.html' }, + { startIndex: 18, type: 'delimiter.html' }, + { startIndex: 19, type: 'attribute.value.html' }, + { startIndex: 24, type: 'delimiter.html' } ] }], @@ -418,17 +418,17 @@ testTokenization(['twig', 'css', 'javascript'], [ [{ line: '', tokens: [ - { startIndex: 0, type: 'delimiter' }, - { startIndex: 1, type: 'tag' }, + { startIndex: 0, type: 'delimiter.html' }, + { startIndex: 1, type: 'tag.html' }, { startIndex: 4, type: '' }, - { startIndex: 5, type: 'attribute.name' }, - { startIndex: 8, type: 'delimiter' }, - { startIndex: 9, type: 'attribute.name' }, // slightly incorrect + { startIndex: 5, type: 'attribute.name.html' }, + { startIndex: 8, type: 'delimiter.html' }, + { startIndex: 9, type: 'attribute.name.html' }, // slightly incorrect { startIndex: 12, type: '' }, - { startIndex: 13, type: 'attribute.name' }, - { startIndex: 16, type: 'delimiter' }, - { startIndex: 17, type: 'attribute.name' }, // slightly incorrect - { startIndex: 24, type: 'delimiter' } + { startIndex: 13, type: 'attribute.name.html' }, + { startIndex: 16, type: 'delimiter.html' }, + { startIndex: 17, type: 'attribute.name.html' }, // slightly incorrect + { startIndex: 24, type: 'delimiter.html' } ] }], @@ -436,14 +436,14 @@ testTokenization(['twig', 'css', 'javascript'], [ [{ line: '', tokens: [ - { startIndex: 0, type: 'delimiter' }, - { startIndex: 1, type: 'tag' }, + { startIndex: 0, type: 'delimiter.html' }, + { startIndex: 1, type: 'tag.html' }, { startIndex: 4, type: '' }, - { startIndex: 5, type: 'attribute.name' }, - { startIndex: 8, type: 'delimiter' }, + { startIndex: 5, type: 'attribute.name.html' }, + { startIndex: 8, type: 'delimiter.html' }, { startIndex: 9, type: '' }, - { startIndex: 11, type: 'attribute.value' }, - { startIndex: 16, type: 'delimiter' } + { startIndex: 11, type: 'attribute.value.html' }, + { startIndex: 16, type: 'delimiter.html' } ] }], @@ -451,15 +451,15 @@ testTokenization(['twig', 'css', 'javascript'], [ [{ line: '', tokens: [ - { startIndex: 0, type: 'delimiter' }, - { startIndex: 1, type: 'tag' }, + { startIndex: 0, type: 'delimiter.html' }, + { startIndex: 1, type: 'tag.html' }, { startIndex: 4, type: '' }, - { startIndex: 5, type: 'attribute.name' }, + { startIndex: 5, type: 'attribute.name.html' }, { startIndex: 8, type: '' }, - { startIndex: 9, type: 'delimiter' }, + { startIndex: 9, type: 'delimiter.html' }, { startIndex: 10, type: '' }, - { startIndex: 11, type: 'attribute.value' }, - { startIndex: 16, type: 'delimiter' } + { startIndex: 11, type: 'attribute.value.html' }, + { startIndex: 16, type: 'delimiter.html' } ] }], @@ -467,11 +467,11 @@ testTokenization(['twig', 'css', 'javascript'], [ [{ line: '', tokens: [ - { startIndex: 0, type: 'delimiter' }, - { startIndex: 1, type: 'tag' }, + { startIndex: 0, type: 'delimiter.html' }, + { startIndex: 1, type: 'tag.html' }, { startIndex: 4, type: '' }, - { startIndex: 5, type: 'attribute.name' }, - { startIndex: 8, type: 'delimiter' } + { startIndex: 5, type: 'attribute.name.html' }, + { startIndex: 8, type: 'delimiter.html' } ] }], @@ -479,13 +479,13 @@ testTokenization(['twig', 'css', 'javascript'], [ [{ line: '', tokens: [ - { startIndex: 0, type: 'delimiter' }, - { startIndex: 1, type: 'tag' }, + { startIndex: 0, type: 'delimiter.html' }, + { startIndex: 1, type: 'tag.html' }, { startIndex: 4, type: '' }, - { startIndex: 5, type: 'attribute.name' }, + { startIndex: 5, type: 'attribute.name.html' }, { startIndex: 8, type: '' }, - { startIndex: 9, type: 'attribute.name' }, - { startIndex: 12, type: 'delimiter' } + { startIndex: 9, type: 'attribute.name.html' }, + { startIndex: 12, type: 'delimiter.html' } ] }], @@ -493,14 +493,14 @@ testTokenization(['twig', 'css', 'javascript'], [ [{ line: '', tokens: [ - { startIndex: 0, type: 'delimiter' }, - { startIndex: 1, type: 'tag' }, + { startIndex: 0, type: 'delimiter.html' }, + { startIndex: 1, type: 'tag.html' }, { startIndex: 4, type: '' }, - { startIndex: 5, type: 'attribute.name' }, + { startIndex: 5, type: 'attribute.name.html' }, { startIndex: 8, type: '' }, - { startIndex: 11, type: 'delimiter' }, - { startIndex: 12, type: 'attribute.value' }, - { startIndex: 17, type: 'delimiter' } + { startIndex: 11, type: 'delimiter.html' }, + { startIndex: 12, type: 'attribute.value.html' }, + { startIndex: 17, type: 'delimiter.html' } ] }], @@ -508,25 +508,25 @@ testTokenization(['twig', 'css', 'javascript'], [ [{ line: '', tokens: [ - { startIndex: 0, type: 'delimiter' }, - { startIndex: 1, type: 'tag' }, + { startIndex: 0, type: 'delimiter.html' }, + { startIndex: 1, type: 'tag.html' }, { startIndex: 4, type: '' }, - { startIndex: 6, type: 'attribute.name' }, + { startIndex: 6, type: 'attribute.name.html' }, { startIndex: 13, type: '' }, - { startIndex: 15, type: 'attribute.name' }, + { startIndex: 15, type: 'attribute.name.html' }, { startIndex: 20, type: '' }, - { startIndex: 21, type: 'delimiter' }, - { startIndex: 22, type: 'attribute.value' }, + { startIndex: 21, type: 'delimiter.html' }, + { startIndex: 22, type: 'attribute.value.html' }, { startIndex: 27, type: '' }, - { startIndex: 29, type: 'attribute.name' }, + { startIndex: 29, type: 'attribute.name.html' }, { startIndex: 34, type: '' }, - { startIndex: 35, type: 'delimiter' }, - { startIndex: 36, type: 'attribute.value' }, + { startIndex: 35, type: 'delimiter.html' }, + { startIndex: 36, type: 'attribute.value.html' }, { startIndex: 50, type: '' }, - { startIndex: 52, type: 'attribute.name' }, - { startIndex: 56, type: 'delimiter' }, - { startIndex: 57, type: 'attribute.value' }, - { startIndex: 72, type: 'delimiter' } + { startIndex: 52, type: 'attribute.name.html' }, + { startIndex: 56, type: 'delimiter.html' }, + { startIndex: 57, type: 'attribute.value.html' }, + { startIndex: 72, type: 'delimiter.html' } ] }], @@ -534,13 +534,13 @@ testTokenization(['twig', 'css', 'javascript'], [ [{ line: '', tokens: [ - { startIndex: 0, type: 'metatag.content' }, - { startIndex: 11, type: 'metatag' } + { startIndex: 0, type: 'metatag.content.html' }, + { startIndex: 11, type: 'metatag.html' } ] }], @@ -623,13 +623,13 @@ testTokenization(['twig', 'css', 'javascript'], [ [{ line: 'asd', tokens: [ - { startIndex: 0, type: 'delimiter' }, - { startIndex: 1, type: 'tag' }, - { startIndex: 9, type: 'delimiter' }, + { startIndex: 0, type: 'delimiter.html' }, + { startIndex: 1, type: 'tag.html' }, + { startIndex: 9, type: 'delimiter.html' }, { startIndex: 10, type: '' }, - { startIndex: 13, type: 'delimiter' }, - { startIndex: 15, type: 'tag' }, - { startIndex: 23, type: 'delimiter' } + { startIndex: 13, type: 'delimiter.html' }, + { startIndex: 15, type: 'tag.html' }, + { startIndex: 23, type: 'delimiter.html' } ] }] ]);