Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions assets/comments2_result.hjson
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3
1 change: 1 addition & 0 deletions assets/comments2_result.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3
3 changes: 3 additions & 0 deletions assets/comments2_test.hjson
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
// before
/* before2 */ 3 // after1
// after2
1 change: 1 addition & 0 deletions assets/comments3_result.hjson
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
a string value // still part of the string
1 change: 1 addition & 0 deletions assets/comments3_result.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
"a string value // still part of the string"
3 changes: 3 additions & 0 deletions assets/comments3_test.hjson
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
// before
/* before2 */ a string value // still part of the string
// after2
23 changes: 23 additions & 0 deletions assets/comments4_result.hjson
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
[
a string value // still part of the string
a string value
{}
{}
{}
[]
{}
{
val5a: 1
val5b: 2
}
[]
[]
[]
[]
[
1
2
]
3
4
]
23 changes: 23 additions & 0 deletions assets/comments4_result.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
[
"a string value // still part of the string",
"a string value",
{},
{},
{},
[],
{},
{
"val5a": 1,
"val5b": 2
},
[],
[],
[],
[],
[
1,
2
],
3,
4
]
51 changes: 51 additions & 0 deletions assets/comments4_test.hjson
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
// before
/* before2 */ [ #before1
/*key1keycm*/a string value // still part of the string
/* key2keycm */ "a string value" // not part of the string
// map1before
/* map1key */
{}//map2after
{}
{
// map3 inner comment
}
[]
// map4before
/*map4key*/{
/* map4inner */
} // map4after
//map5before
/*map5key*/ {
//map5ab4
val5a: /* map5akey */ 1, // map5aAfter
val5b: 2 /* map5bb4comma */ , #map5bAfter
#map5extra
} /* map5after */
// vec1bbefore
/* vec1bkey */
[]//vec1bafter
[]
[
// vec3 inner comment
]
// vec4before
/*vec4key*/[
/* vec4inner */
] // vec4after
//vec5before
/*vec5key*/ [
//vec5ab4
1, // vec5aAfter
2 /* vec5bb4comma */ , #vec5bAfter
#vec5extra
] /* map5after */
// before3

3 # after3
# before4
/*before4b*/4/*after4*/
#after4b
]
// after2

/* after3 */
25 changes: 25 additions & 0 deletions assets/comments5_result.hjson
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
key1: a string value // still part of the string
key2: a string value
map1: {}
map2: {}
map3: {}
vec1: []
map4: {}
map5:
{
val5a: 1
val5b: 2
}
vec1b: []
vec2: []
vec3: []
vec4: []
vec5:
[
1
2
]
key3: 3
key4: 4
}
23 changes: 23 additions & 0 deletions assets/comments5_result.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"key1": "a string value // still part of the string",
"key2": "a string value",
"map1": {},
"map2": {},
"map3": {},
"vec1": [],
"map4": {},
"map5": {
"val5a": 1,
"val5b": 2
},
"vec1b": [],
"vec2": [],
"vec3": [],
"vec4": [],
"vec5": [
1,
2
],
"key3": 3,
"key4": 4
}
51 changes: 51 additions & 0 deletions assets/comments5_test.hjson
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
// before
/* before2 */ { #before1
key1:/*key1keycm*/a string value // still part of the string
key2: /* key2keycm */ "a string value" // not part of the string
// map1before
map1: /* map1key */
{}//map2after
map2: {}
map3: {
// map3 inner comment
}
vec1: []
// map4before
map4:/*map4key*/{
/* map4inner */
} // map4after
//map5before
map5: /*map5key*/ {
//map5ab4
val5a: /* map5akey */ 1, // map5aAfter
val5b: 2 /* map5bb4comma */ , #map5bAfter
#map5extra
} /* map5after */
// vec1bbefore
vec1b: /* vec1bkey */
[]//vec1bafter
vec2: []
vec3: [
// vec3 inner comment
]
// vec4before
vec4:/*vec4key*/[
/* vec4inner */
] // vec4after
//vec5before
vec5: /*vec5key*/ [
//vec5ab4
1, // vec5aAfter
2 /* vec5bb4comma */ , #vec5bAfter
#vec5extra
] /* map5after */
// before3

key3 : 3 # after3
# before4
/*before4b*/key4:4/*after4*/
#after4b
}
// after2

/* after3 */
1 change: 1 addition & 0 deletions assets/comments6_result.hjson
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3
1 change: 1 addition & 0 deletions assets/comments6_result.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3
3 changes: 3 additions & 0 deletions assets/comments6_test.hjson
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
// before
/* before2 */ 3 // after1
// after2
8 changes: 8 additions & 0 deletions assets/comments7_result.hjson
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
b:
{
sub1: 3
sub2: 4
}
a: 2
}
7 changes: 7 additions & 0 deletions assets/comments7_result.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"b": {
"sub1": 3,
"sub2": 4
},
"a": 2
}
8 changes: 8 additions & 0 deletions assets/comments7_test.hjson
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# comment before
b: /* key comment */ {
sub1: 3 # comment after
sub2: 4 # comment more after
} # cm after obj
// Comment B4
a: 2
/* Last comment */
4 changes: 4 additions & 0 deletions assets/pass5_result.hjson
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
bigDouble: 9.223372036854776e+58
bigInt: 9.223372036854776e+58
}
4 changes: 4 additions & 0 deletions assets/pass5_result.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"bigDouble": 9.223372036854776e+58,
"bigInt": 9.223372036854776e+58
}
4 changes: 4 additions & 0 deletions assets/pass5_test.hjson
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
bigDouble: 92233720368547758073829419051489548484843823585675828488686.0
bigInt: 92233720368547758073829419051489548484843823585675828488686
}
8 changes: 8 additions & 0 deletions assets/pass6_result.hjson
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
a: 1
b: 2
c: 3
d: 4
e: 5
f: 6
}
8 changes: 8 additions & 0 deletions assets/pass6_result.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"a": 1,
"b": 2,
"c": 3,
"d": 4,
"e": 5,
"f": 6
}
1 change: 1 addition & 0 deletions assets/pass6_test.hjson
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
a: 1, b: 2,c:3,'d' /*cm1*/ : 4, /*cm2 */ e: /* cm3*/ 5 /* cm 4 */ f : 6
7 changes: 7 additions & 0 deletions assets/root_result.hjson
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
database:
{
host: 127.0.0.1
port: 555
}
}
6 changes: 6 additions & 0 deletions assets/root_result.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"database": {
"host": "127.0.0.1",
"port": 555
}
}
6 changes: 6 additions & 0 deletions assets/root_test.hjson
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
// a object with the root braces omitted
database:
{
host: 127.0.0.1
port: 555
}
11 changes: 10 additions & 1 deletion assets/testlist.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
charset_test.hjson
charset2_test.hjson
charset_test.hjson
comments_test.hjson
comments2_test.hjson
comments3_test.hjson
comments4_test.hjson
comments5_test.hjson
comments6_test.hjson
comments7_test.hjson
empty_test.hjson
failCharset1_test.hjson
failJSON02_test.json
Expand Down Expand Up @@ -72,7 +78,10 @@ pass1_test.json
pass2_test.json
pass3_test.json
pass4_test.json
pass5_test.hjson
pass6_test.hjson
passSingle_test.hjson
root_test.hjson
stringify1_test.hjson
strings2_test.hjson
strings_test.hjson
Expand Down
5 changes: 1 addition & 4 deletions src/test/org/hjson/test/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,7 @@ private static boolean test(String name, String file, boolean inputCr, boolean o
String text=load(file, inputCr);

try {
HjsonOptions opt=new HjsonOptions();
opt.setParseLegacyRoot(false);

JsonValue data=JsonValue.readHjson(text, opt);
JsonValue data=JsonValue.readHjson(text);
String data1=data.toString(Stringify.FORMATTED);
String hjson1=data.toString(Stringify.HJSON);
if (!shouldFail) {
Expand Down