mirror of
https://github.com/github/codeql.git
synced 2026-05-05 21:55:19 +02:00
QL code and tests for C#/C++/JavaScript.
This commit is contained in:
2
javascript/ql/test/library-tests/JSON/JSONError.expected
Normal file
2
javascript/ql/test/library-tests/JSON/JSONError.expected
Normal file
@@ -0,0 +1,2 @@
|
||||
| invalid.json:3:1:3:1 | Error: Comments are not legal in JSON. |
|
||||
| invalid.json:4:1:4:1 | Error: Comments are not legal in JSON. |
|
||||
4
javascript/ql/test/library-tests/JSON/JSONError.ql
Normal file
4
javascript/ql/test/library-tests/JSON/JSONError.ql
Normal file
@@ -0,0 +1,4 @@
|
||||
import semmle.javascript.JSON
|
||||
|
||||
from JSONParseError jpe
|
||||
select jpe
|
||||
10
javascript/ql/test/library-tests/JSON/JSONObject.expected
Normal file
10
javascript/ql/test/library-tests/JSON/JSONObject.expected
Normal file
@@ -0,0 +1,10 @@
|
||||
| tst.json:1:2:8:1 | {\\n "na ... "\\n }\\n} | address | tst.json:3:14:7:3 | {\\n " ... nd"\\n } | (none) |
|
||||
| tst.json:1:2:8:1 | {\\n "na ... "\\n }\\n} | name | tst.json:2:11:2:21 | "Jim Knopf" | Jim Knopf |
|
||||
| tst.json:3:14:7:3 | {\\n " ... nd"\\n } | country | tst.json:6:16:6:27 | "Lummerland" | Lummerland |
|
||||
| tst.json:3:14:7:3 | {\\n " ... nd"\\n } | number | tst.json:5:15:5:16 | -1 | (none) |
|
||||
| tst.json:3:14:7:3 | {\\n " ... nd"\\n } | street | tst.json:4:15:4:18 | null | (none) |
|
||||
| tst.json:8:4:15:1 | {\\n "na ... "\\n }\\n} | address | tst.json:10:14:14:3 | {\\n " ... nd"\\n } | (none) |
|
||||
| tst.json:8:4:15:1 | {\\n "na ... "\\n }\\n} | name | tst.json:9:11:9:25 | "Frau Mahlzahn" | Frau Mahlzahn |
|
||||
| tst.json:10:14:14:3 | {\\n " ... nd"\\n } | country | tst.json:13:16:13:27 | "Kummerland" | Kummerland |
|
||||
| tst.json:10:14:14:3 | {\\n " ... nd"\\n } | number | tst.json:12:15:12:17 | 133 | (none) |
|
||||
| tst.json:10:14:14:3 | {\\n " ... nd"\\n } | street | tst.json:11:15:11:28 | "Alte Strasse" | Alte Strasse |
|
||||
9
javascript/ql/test/library-tests/JSON/JSONObject.ql
Normal file
9
javascript/ql/test/library-tests/JSON/JSONObject.ql
Normal file
@@ -0,0 +1,9 @@
|
||||
import semmle.javascript.JSON
|
||||
|
||||
from JSONObject obj, string prop, JSONValue val, string strval
|
||||
where val = obj.getPropValue(prop) and
|
||||
(if exists(obj.getPropStringValue(prop)) then
|
||||
strval = obj.getPropStringValue(prop)
|
||||
else
|
||||
strval = "(none)")
|
||||
select obj, prop, val, strval
|
||||
14
javascript/ql/test/library-tests/JSON/JSONValue.expected
Normal file
14
javascript/ql/test/library-tests/JSON/JSONValue.expected
Normal file
@@ -0,0 +1,14 @@
|
||||
| invalid.json:1:1:1:4 | "hi" |
|
||||
| tst.json:1:1:15:2 | [{\\n "n ... \\n }\\n}] |
|
||||
| tst.json:1:2:8:1 | {\\n "na ... "\\n }\\n} |
|
||||
| tst.json:2:11:2:21 | "Jim Knopf" |
|
||||
| tst.json:3:14:7:3 | {\\n " ... nd"\\n } |
|
||||
| tst.json:4:15:4:18 | null |
|
||||
| tst.json:5:15:5:16 | -1 |
|
||||
| tst.json:6:16:6:27 | "Lummerland" |
|
||||
| tst.json:8:4:15:1 | {\\n "na ... "\\n }\\n} |
|
||||
| tst.json:9:11:9:25 | "Frau Mahlzahn" |
|
||||
| tst.json:10:14:14:3 | {\\n " ... nd"\\n } |
|
||||
| tst.json:11:15:11:28 | "Alte Strasse" |
|
||||
| tst.json:12:15:12:17 | 133 |
|
||||
| tst.json:13:16:13:27 | "Kummerland" |
|
||||
4
javascript/ql/test/library-tests/JSON/JSONValue.ql
Normal file
4
javascript/ql/test/library-tests/JSON/JSONValue.ql
Normal file
@@ -0,0 +1,4 @@
|
||||
import semmle.javascript.JSON
|
||||
|
||||
from JSONValue v
|
||||
select v
|
||||
4
javascript/ql/test/library-tests/JSON/invalid.json
Normal file
4
javascript/ql/test/library-tests/JSON/invalid.json
Normal file
@@ -0,0 +1,4 @@
|
||||
"hi"
|
||||
|
||||
// JSON doesn't have comments
|
||||
// semmle-extractor-options: --tolerate-parse-errors
|
||||
15
javascript/ql/test/library-tests/JSON/tst.json
Normal file
15
javascript/ql/test/library-tests/JSON/tst.json
Normal file
@@ -0,0 +1,15 @@
|
||||
[{
|
||||
"name": "Jim Knopf",
|
||||
"address": {
|
||||
"street": null,
|
||||
"number": -1,
|
||||
"country": "Lummerland"
|
||||
}
|
||||
}, {
|
||||
"name": "Frau Mahlzahn",
|
||||
"address": {
|
||||
"street": "Alte Strasse",
|
||||
"number": 133,
|
||||
"country": "Kummerland"
|
||||
}
|
||||
}]
|
||||
Reference in New Issue
Block a user