File tree Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -65,6 +65,29 @@ TEST(JSONSchema_format, example_3) {
65
65
})JSON" );
66
66
}
67
67
68
+ TEST (JSONSchema_format, example_4) {
69
+ const sourcemeta::core::JSON document = sourcemeta::core::parse_json (R"JSON( {
70
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
71
+ "properties": {
72
+ "abc": true,
73
+ "id_key": false
74
+ }
75
+ })JSON" );
76
+
77
+ std::ostringstream stream;
78
+ sourcemeta::core::prettify (document, stream,
79
+ sourcemeta::core::schema_format_compare);
80
+
81
+ // `id_key` must go _after_ `abc` given alphabetic ordering
82
+ EXPECT_EQ (stream.str (), R"JSON( {
83
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
84
+ "properties": {
85
+ "abc": true,
86
+ "id_key": false
87
+ }
88
+ })JSON" );
89
+ }
90
+
68
91
TEST (JSONSchema_format, compare_known_vs_unknown) {
69
92
EXPECT_TRUE (sourcemeta::core::schema_format_compare (" $id" , " foo" ));
70
93
EXPECT_FALSE (sourcemeta::core::schema_format_compare (" foo" , " $id" ));
You can’t perform that action at this time.
0 commit comments