diff options
Diffstat (limited to 'tests/snippets/javascript')
10 files changed, 303 insertions, 0 deletions
diff --git a/tests/snippets/javascript/test_binary_literal_negative_matches.txt b/tests/snippets/javascript/test_binary_literal_negative_matches.txt new file mode 100644 index 00000000..f36ce045 --- /dev/null +++ b/tests/snippets/javascript/test_binary_literal_negative_matches.txt @@ -0,0 +1,27 @@ +---input--- +// Test text that should **not** be tokenized as binary literals. +0b0N +0b +0bb +0b2 + +---tokens--- +'' Text +'// Test text that should **not** be tokenized as binary literals.' Comment.Single +'\n' Text.Whitespace + +'0b0' Literal.Number.Bin +'N' Name.Other +'\n' Text.Whitespace + +'0' Literal.Number.Float +'b' Name.Other +'\n' Text.Whitespace + +'0' Literal.Number.Float +'bb' Name.Other +'\n' Text.Whitespace + +'0' Literal.Number.Float +'b2' Name.Other +'\n' Text.Whitespace diff --git a/tests/snippets/javascript/test_binary_literal_positive_matches.txt b/tests/snippets/javascript/test_binary_literal_positive_matches.txt new file mode 100644 index 00000000..9773c95b --- /dev/null +++ b/tests/snippets/javascript/test_binary_literal_positive_matches.txt @@ -0,0 +1,15 @@ +---input--- +// Test literals that should be tokenized as binary literals. +0b01 +0B10n + +---tokens--- +'' Text +'// Test literals that should be tokenized as binary literals.' Comment.Single +'\n' Text.Whitespace + +'0b01' Literal.Number.Bin +'\n' Text.Whitespace + +'0B10n' Literal.Number.Bin +'\n' Text.Whitespace diff --git a/tests/snippets/javascript/test_float_literals_negative_matches.txt b/tests/snippets/javascript/test_float_literals_negative_matches.txt new file mode 100644 index 00000000..dc13b5f6 --- /dev/null +++ b/tests/snippets/javascript/test_float_literals_negative_matches.txt @@ -0,0 +1,60 @@ +---input--- +// Test text that should **not** be tokenized as float literals. +.୪ +. +1.. +1n +1ee +1e +1e- +1e--1 +1e++1 +1e1.0 + +---tokens--- +'' Text +'// Test text that should **not** be tokenized as float literals.' Comment.Single +'\n' Text.Whitespace + +'.' Punctuation +'୪' Error +'\n' Text.Whitespace + +'.' Punctuation +'\n' Text.Whitespace + +'1.' Literal.Number.Float +'.' Punctuation +'\n' Text.Whitespace + +'1n' Literal.Number.Integer +'\n' Text.Whitespace + +'1' Literal.Number.Float +'ee' Name.Other +'\n' Text.Whitespace + +'1' Literal.Number.Float +'e' Name.Other +'\n' Text.Whitespace + +'1' Literal.Number.Float +'e' Name.Other +'-' Operator +'\n' Text.Whitespace + +'1' Literal.Number.Float +'e' Name.Other +'--' Operator +'1' Literal.Number.Float +'\n' Text.Whitespace + +'1' Literal.Number.Float +'e' Name.Other +'++' Operator +'1' Literal.Number.Float +'\n' Text.Whitespace + +'1e1' Literal.Number.Float +'.0' Literal.Number.Float +'\n' Text.Whitespace diff --git a/tests/snippets/javascript/test_float_literals_positive_matches.txt b/tests/snippets/javascript/test_float_literals_positive_matches.txt new file mode 100644 index 00000000..3342112e --- /dev/null +++ b/tests/snippets/javascript/test_float_literals_positive_matches.txt @@ -0,0 +1,52 @@ +---input--- +// Test literals that should be tokenized as float literals. +1 +1. + .1 +1.1 +1e1 +1E1 +1e+1 +1E-1 +1.e1 +1e1 +0888 // octal prefix with non-octal numbers + +---tokens--- +'' Text +'// Test literals that should be tokenized as float literals.' Comment.Single +'\n' Text.Whitespace + +'1' Literal.Number.Float +'\n' Text.Whitespace + +'1.' Literal.Number.Float +'\n ' Text.Whitespace +'.1' Literal.Number.Float +'\n' Text.Whitespace + +'1.1' Literal.Number.Float +'\n' Text.Whitespace + +'1e1' Literal.Number.Float +'\n' Text.Whitespace + +'1E1' Literal.Number.Float +'\n' Text.Whitespace + +'1e+1' Literal.Number.Float +'\n' Text.Whitespace + +'1E-1' Literal.Number.Float +'\n' Text.Whitespace + +'1.e1' Literal.Number.Float +'\n' Text.Whitespace + +'1e1' Literal.Number.Float +'\n' Text.Whitespace + +'0888' Literal.Number.Float +' ' Text.Whitespace +'// octal prefix with non-octal numbers' Comment.Single +'\n' Text.Whitespace diff --git a/tests/snippets/javascript/test_hexadecimal_literal_negative_matches.txt b/tests/snippets/javascript/test_hexadecimal_literal_negative_matches.txt new file mode 100644 index 00000000..be3e606a --- /dev/null +++ b/tests/snippets/javascript/test_hexadecimal_literal_negative_matches.txt @@ -0,0 +1,32 @@ +---input--- +// Test text that should **not** be tokenized as hexadecimal literals. +0x0N +0x +0Xx +0xg +0xhn + +---tokens--- +'' Text +'// Test text that should **not** be tokenized as hexadecimal literals.' Comment.Single +'\n' Text.Whitespace + +'0x0' Literal.Number.Hex +'N' Name.Other +'\n' Text.Whitespace + +'0' Literal.Number.Float +'x' Name.Other +'\n' Text.Whitespace + +'0' Literal.Number.Float +'Xx' Name.Other +'\n' Text.Whitespace + +'0' Literal.Number.Float +'xg' Name.Other +'\n' Text.Whitespace + +'0' Literal.Number.Float +'xhn' Name.Other +'\n' Text.Whitespace diff --git a/tests/snippets/javascript/test_hexadecimal_literal_positive_matches.txt b/tests/snippets/javascript/test_hexadecimal_literal_positive_matches.txt new file mode 100644 index 00000000..32ae4b6a --- /dev/null +++ b/tests/snippets/javascript/test_hexadecimal_literal_positive_matches.txt @@ -0,0 +1,19 @@ +---input--- +// Test literals that should be tokenized as hexadecimal literals. +0x01 +0Xefn +0x0EF + +---tokens--- +'' Text +'// Test literals that should be tokenized as hexadecimal literals.' Comment.Single +'\n' Text.Whitespace + +'0x01' Literal.Number.Hex +'\n' Text.Whitespace + +'0Xefn' Literal.Number.Hex +'\n' Text.Whitespace + +'0x0EF' Literal.Number.Hex +'\n' Text.Whitespace diff --git a/tests/snippets/javascript/test_integer_literal_negative_matches.txt b/tests/snippets/javascript/test_integer_literal_negative_matches.txt new file mode 100644 index 00000000..57bc35f3 --- /dev/null +++ b/tests/snippets/javascript/test_integer_literal_negative_matches.txt @@ -0,0 +1,20 @@ +---input--- +// Test text that should **not** be tokenized as integer literals. +1N +1 +1.0 + +---tokens--- +'' Text +'// Test text that should **not** be tokenized as integer literals.' Comment.Single +'\n' Text.Whitespace + +'1' Literal.Number.Float +'N' Name.Other +'\n' Text.Whitespace + +'1' Literal.Number.Float +'\n' Text.Whitespace + +'1.0' Literal.Number.Float +'\n' Text.Whitespace diff --git a/tests/snippets/javascript/test_integer_literal_positive_matches.txt b/tests/snippets/javascript/test_integer_literal_positive_matches.txt new file mode 100644 index 00000000..c69f489e --- /dev/null +++ b/tests/snippets/javascript/test_integer_literal_positive_matches.txt @@ -0,0 +1,15 @@ +---input--- +// Test literals that should be tokenized as integer literals. +0n +123n + +---tokens--- +'' Text +'// Test literals that should be tokenized as integer literals.' Comment.Single +'\n' Text.Whitespace + +'0n' Literal.Number.Integer +'\n' Text.Whitespace + +'123n' Literal.Number.Integer +'\n' Text.Whitespace diff --git a/tests/snippets/javascript/test_octal_literal_negative_matches.txt b/tests/snippets/javascript/test_octal_literal_negative_matches.txt new file mode 100644 index 00000000..53aea59b --- /dev/null +++ b/tests/snippets/javascript/test_octal_literal_negative_matches.txt @@ -0,0 +1,40 @@ +---input--- +// Test text that should **not** be tokenized as octal literals. +01N +089 +098 +0o +0OO +0o88 +0O88n + +---tokens--- +'' Text +'// Test text that should **not** be tokenized as octal literals.' Comment.Single +'\n' Text.Whitespace + +'01' Literal.Number.Oct +'N' Name.Other +'\n' Text.Whitespace + +'089' Literal.Number.Float +'\n' Text.Whitespace + +'098' Literal.Number.Float +'\n' Text.Whitespace + +'0' Literal.Number.Float +'o' Name.Other +'\n' Text.Whitespace + +'0' Literal.Number.Float +'OO' Name.Other +'\n' Text.Whitespace + +'0' Literal.Number.Float +'o88' Name.Other +'\n' Text.Whitespace + +'0' Literal.Number.Float +'O88n' Name.Other +'\n' Text.Whitespace diff --git a/tests/snippets/javascript/test_octal_literal_positive_matches.txt b/tests/snippets/javascript/test_octal_literal_positive_matches.txt new file mode 100644 index 00000000..67c90f80 --- /dev/null +++ b/tests/snippets/javascript/test_octal_literal_positive_matches.txt @@ -0,0 +1,23 @@ +---input--- +// Test literals that should be tokenized as octal literals. +017 +071n +0o11 +0O77n + +---tokens--- +'' Text +'// Test literals that should be tokenized as octal literals.' Comment.Single +'\n' Text.Whitespace + +'017' Literal.Number.Oct +'\n' Text.Whitespace + +'071n' Literal.Number.Oct +'\n' Text.Whitespace + +'0o11' Literal.Number.Oct +'\n' Text.Whitespace + +'0O77n' Literal.Number.Oct +'\n' Text.Whitespace |