Skip to content

Commit

Permalink
Extended testing (#55)
Browse files Browse the repository at this point in the history
  • Loading branch information
trobro authored Dec 11, 2022
1 parent 77d0dc9 commit 0cb03b8
Show file tree
Hide file tree
Showing 174 changed files with 1,902 additions and 95 deletions.
12 changes: 9 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@ jobs:
- uses: actions/checkout@v3
- run: go version
- run: go test -v
- run: |
cd hjson-cli
go install
- run: cd hjson-cli && go build
- if: runner.os == 'Linux'
run: hjson-cli/hjson-cli assets/comments_test.hjson | diff assets/sorted/comments_result.hjson -
- if: runner.os == 'Linux'
run: hjson-cli/hjson-cli -j assets/comments_test.hjson | diff assets/sorted/comments_result.json -
- if: runner.os == 'Linux'
run: hjson-cli/hjson-cli -preserveKeyOrder assets/comments_test.hjson | diff assets/comments_result.hjson -
- if: runner.os == 'Linux'
run: hjson-cli/hjson-cli -j -preserveKeyOrder assets/comments_test.hjson | diff assets/comments_result.json -
2 changes: 1 addition & 1 deletion assets/charset2_result.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
"uescape": "\u0000,\u0001,￿",
"umlaut": "äöüßÄÖÜ",
"hex": "ģ䕧覫췯ꯍ"
}
}
2 changes: 1 addition & 1 deletion assets/charset_result.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
"ql-ascii": "! \"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~",
"js-ascii": "! \"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~",
"ml-ascii": "! \"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~"
}
}
5 changes: 5 additions & 0 deletions assets/comments2/charset2_result.hjson
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
uescape: "\u0000,\u0001,\uffff"
umlaut: äöüßÄÖÜ
hex: ģ䕧覫췯ꯍ
}
5 changes: 5 additions & 0 deletions assets/comments2/charset_result.hjson
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
ql-ascii: ! "#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~
js-ascii: ! "#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~
ml-ascii: ! "#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~
}
3 changes: 3 additions & 0 deletions assets/comments2/comments2_result.hjson
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
// before
/* before2 */ 3 // after1
// after2
3 changes: 3 additions & 0 deletions assets/comments2/comments3_result.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
51 changes: 51 additions & 0 deletions assets/comments2/comments4_result.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 */
51 changes: 51 additions & 0 deletions assets/comments2/comments5_result.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 */
4 changes: 4 additions & 0 deletions assets/comments2/comments6_result.hjson
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
// before
/* before2 */ 3 // after1
// after2

10 changes: 10 additions & 0 deletions assets/comments2/comments7_result.hjson
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
# comment before
b: /* key comment */ {
sub1: 3 # comment after
sub2: 4 # comment more after
} # cm after obj
// Comment B4
a: 2
/* Last comment */
}
42 changes: 42 additions & 0 deletions assets/comments2/comments_result.hjson
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
// test
# all
// comment
/*
styles
*/
# with lf



# !

{
# hjson style comment
foo1: This is a string value. # part of the string
foo2: "This is a string value." # a comment

// js style comment
bar1: This is a string value. // part of the string
bar2: "This is a string value." // a comment

/* js block style comments */foobar1:/* more */This is a string value./* part of the string */
/* js block style comments */foobar2:/* more */"This is a string value."/* a comment */
rem1: "# test"
rem2: "// test"
rem3: "/* test */"
num1: 0 # comment
num2: 0 // comment
num3: 2 /* comment */
true1: true # comment
true2: true // comment
true3: true /* comment */
false1: false # comment
false2: false // comment
false3: false /* comment */
null1: null # comment
null2: null // comment
null3: null /* comment */
str1: 00 # part of the string
str2: 00.0 // part of the string
str3: 02 /* part of the string */
}
3 changes: 3 additions & 0 deletions assets/comments2/empty_result.hjson
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"": empty
}
3 changes: 3 additions & 0 deletions assets/comments2/int64_result.hjson
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
bigInt: 144115188075855870
}
46 changes: 46 additions & 0 deletions assets/comments2/kan_result.hjson
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
{
# the comma forces a whitespace check
numbers: [
0
0
0
42
42.1
-5
-5.1
1701
-1701
12.345
-12.345
]
native: [
true
true
false
false
null
null
]
strings: [
x 0
.0
00
01
0 0 0
42 x
42.1 asdf
1.2.3
-5 0 -
-5.1 --
17.01e2 +
-17.01e2 :
12345e-3 @
-12345e-3 $
true true
x true
false false
x false
null null
x null
]
}
43 changes: 43 additions & 0 deletions assets/comments2/keys_result.hjson
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
{
# unquoted keys
unquoted_key: test
_unquoted: test
test-key: test
-test: test
.key: test
# trailing spaces in key names are ignored
trailing: test
trailing2: test
# comment char in key name
"#c1": test
"foo#bar": test
"//bar": test
"foo//bar": test
"/*foo*/": test
"foo/*foo*/bar": test
"/*": test
"foo/*bar": test
# quotes in key name
"\"": test
"foo\"bar": test
"'''": test
"foo'''bar": test
"'": test
"'foo": test
"foo'bar": test
# control char in key name
":": test
"foo:bar": test
"{": test
"foo{bar": test
"}": test
"foo}bar": test
"[": test
"foo[bar": test
"]": test
"foo]bar": test
# newline
nl1: test
nl2: test
nl3: test
}
8 changes: 8 additions & 0 deletions assets/comments2/mltabs_result.hjson
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
foo:
'''
bar joe
oki doki
two tabs
'''
}
13 changes: 13 additions & 0 deletions assets/comments2/oa_result.hjson
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
[
a
{}
{}
[]
[]
{
b: 1
c: []
d: {}
}
[]
]
Loading

0 comments on commit 0cb03b8

Please sign in to comment.