From e8f7454ea11df4f89ac98e6b14c761ee551ae791 Mon Sep 17 00:00:00 2001 From: Mathias Vorreiter Pedersen Date: Thu, 4 Jun 2026 14:59:58 +0100 Subject: [PATCH] JS: Add tests. --- .../Comments/YamlComments.expected | 20 ++++++++++++++ .../library-tests/Comments/YamlComments.ql | 4 +++ .../test/library-tests/Comments/comments.yml | 26 +++++++++++++++++++ 3 files changed, 50 insertions(+) create mode 100644 javascript/ql/test/library-tests/Comments/YamlComments.expected create mode 100644 javascript/ql/test/library-tests/Comments/YamlComments.ql create mode 100644 javascript/ql/test/library-tests/Comments/comments.yml diff --git a/javascript/ql/test/library-tests/Comments/YamlComments.expected b/javascript/ql/test/library-tests/Comments/YamlComments.expected new file mode 100644 index 00000000000..86a59df80f6 --- /dev/null +++ b/javascript/ql/test/library-tests/Comments/YamlComments.expected @@ -0,0 +1,20 @@ +| comments.yml:1:1:1:22 | # leadi ... comment | leading file comment | +| comments.yml:2:5:2:29 | # docum ... comment | document marker comment | +| comments.yml:3:7:3:29 | #commen ... oot key | comment after root key | +| comments.yml:4:3:4:42 | # inden ... roperty | indented comment before first property | +| comments.yml:5:15:5:43 | # comme ... scalar | comment after quoted scalar | +| comments.yml:6:10:6:46 | #commen ... l value | comment after an explicit null value | +| comments.yml:7:9:7:32 | # comme ... ist key | comment after list key | +| comments.yml:8:5:8:34 | # comme ... ce item | comment before sequence item | +| comments.yml:9:13:9:50 | #commen ... mapping | comment after inline sequence mapping | +| comments.yml:10:20:10:47 | # comme ... scalar | comment after plain scalar | +| comments.yml:11:7:11:31 | # comme ... re dash | comment after bare dash | +| comments.yml:12:13:12:51 | # comme ... equence | comment after mapping key in sequence | +| comments.yml:13:21:13:42 | #commen ... boolean | comment after boolean | +| comments.yml:14:27:14:55 | # comme ... equence | comment after flow sequence | +| comments.yml:15:33:15:60 | # comme ... mapping | comment after flow mapping | +| comments.yml:16:55:16:79 | # comme ... ow list | comment after flow list | +| comments.yml:17:12:17:47 | #commen ... header | comment after literal scalar header | +| comments.yml:20:13:20:47 | #commen ... header | comment after folded scalar header | +| comments.yml:23:52:23:85 | # comme ... g value | comment after hash-looking value | +| comments.yml:24:1:24:39 | # comme ... ent end | comment between body and document end | diff --git a/javascript/ql/test/library-tests/Comments/YamlComments.ql b/javascript/ql/test/library-tests/Comments/YamlComments.ql new file mode 100644 index 00000000000..772056eeed6 --- /dev/null +++ b/javascript/ql/test/library-tests/Comments/YamlComments.ql @@ -0,0 +1,4 @@ +import javascript + +from YamlComment c +select c, c.getText() diff --git a/javascript/ql/test/library-tests/Comments/comments.yml b/javascript/ql/test/library-tests/Comments/comments.yml new file mode 100644 index 00000000000..f35f21a2916 --- /dev/null +++ b/javascript/ql/test/library-tests/Comments/comments.yml @@ -0,0 +1,26 @@ +# leading file comment +--- # document marker comment +root: #comment after root key + # indented comment before first property + name: "odd" # comment after quoted scalar + empty: #comment after an explicit null value + list: # comment after list key + # comment before sequence item + - id: 1 #comment after inline sequence mapping + label: plain # comment after plain scalar + - # comment after bare dash + id: 2 # comment after mapping key in sequence + enabled: true #comment after boolean + tags: [alpha, beta] # comment after flow sequence + flow_map: {left: 1, right: 2} # comment after flow mapping + flow_list: [first, second, "third # not a comment"] # comment after flow list + block: | #comment after literal scalar header + this line belongs to the scalar + # this hash is text, not a YAML comment + folded: > #comment after folded scalar header + folded text with # also just text + and another scalar line + trailing_hash: "there is # no comment # in here" # comment after hash-looking value +# comment between body and document end +... # document end comment +# final comment after document end \ No newline at end of file