File tree Expand file tree Collapse file tree 2 files changed +40
-0
lines changed Expand file tree Collapse file tree 2 files changed +40
-0
lines changed Original file line number Diff line number Diff line change @@ -43,6 +43,7 @@ add_jsonschema_test_unix(validate/fail_relative_external_ref_missing)
43
43
add_jsonschema_test_unix (validate/fail_resolve_enoent )
44
44
add_jsonschema_test_unix (validate/fail_resolve_directory_with_invalid_json )
45
45
add_jsonschema_test_unix (validate/fail_resolve_invalid_json )
46
+ add_jsonschema_test_unix (validate/fail_resolve_missing_open_brace )
46
47
add_jsonschema_test_unix (validate/fail_schema_directory )
47
48
add_jsonschema_test_unix (validate/fail_schema_enoent )
48
49
add_jsonschema_test_unix (validate/fail_schema_invalid_json )
Original file line number Diff line number Diff line change
1
+ #! /bin/sh
2
+
3
+ set -o errexit
4
+ set -o nounset
5
+
6
+ TMP=" $( mktemp -d) "
7
+ clean () { rm -rf " $TMP " ; }
8
+ trap clean EXIT
9
+
10
+ cat << 'EOF ' > "$TMP/schema.json"
11
+ {
12
+ "$schema": "http://json-schema.org/draft-04/schema#",
13
+ "type": "string"
14
+ }
15
+ EOF
16
+
17
+ cat << 'EOF ' > "$TMP/instance.json"
18
+ "foo"
19
+ EOF
20
+
21
+ cat << 'EOF ' > "$TMP/invalid.json"
22
+
23
+ "$schema": "http://json-schema.org/draft-04/schema#",
24
+ "$id": "https://example.com",
25
+ "type": "string"
26
+ }
27
+ EOF
28
+
29
+ " $1 " validate " $TMP /schema.json" " $TMP /instance.json" \
30
+ --resolve " $TMP /invalid.json" 2> " $TMP /stderr.txt" \
31
+ && CODE=" $? " || CODE=" $? "
32
+ test " $CODE " = " 1" || exit 1
33
+
34
+ cat << EOF > "$TMP /expected.txt"
35
+ error: Failed to parse the JSON document at line 2 and column 3
36
+ $( realpath " $TMP " ) /invalid.json
37
+ EOF
38
+
39
+ diff " $TMP /stderr.txt" " $TMP /expected.txt"
You can’t perform that action at this time.
0 commit comments