Skip to content
Open
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
21 changes: 8 additions & 13 deletions tests/helpers.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -154,19 +154,14 @@ proc _compare_json {opts j1 j2 {path {}}} { #<<<

#>>>
proc compare_json args { #<<<
parse_args $args {
-subset {-default none}
j1 {}
j2 {}
} opts

try {
_compare_json $opts [dict get $opts j1] [dict get $opts j2]
} trap {RL TEST JSON_MISMATCH} {errmsg options} {
return $errmsg
} on ok {} {
return match
}
set opts [list -subset none j1 [lindex $args 0] j2 [lindex $args 1]]
try {
_compare_json $opts [dict get $opts j1] [dict get $opts j2]
} trap {RL TEST JSON_MISMATCH} {errmsg options} {
return $errmsg
} on ok {} {
return match
}
}

#>>>
Expand Down
4 changes: 2 additions & 2 deletions tests/number.test
Original file line number Diff line number Diff line change
Expand Up @@ -239,14 +239,14 @@ test number-2.3 {json number, not a number} -body { #<<<
list $code $r [dict get $o -errorcode]
} -cleanup {
unset -nocomplain code r o
} -result [list 1 {can't use non-numeric string "foo" as operand of "+"} {ARITH DOMAIN {non-numeric string}}]
} -result [list 1 {can't use non-numeric string as operand of "+"} {ARITH DOMAIN {non-numeric string}}]
#>>>
test number-2.4 {json number, not a number: empty string} -body { #<<<
set code [catch {json number ""} r o]
list $code $r [dict get $o -errorcode]
} -cleanup {
unset -nocomplain code r o
} -result [list 1 {can't use empty string "" as operand of "+"} {ARITH DOMAIN {empty string}}]
} -result [list 1 {can't use empty string as operand of "+"} {ARITH DOMAIN {empty string}}]
#>>>

::tcltest::cleanupTests
Expand Down
3 changes: 1 addition & 2 deletions tests/pretty.test
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ if {"::tcltest" ni [namespace children]} {
}

package require rl_json
package require parse_args
namespace path {::rl_json ::parse_args}
namespace path {::rl_json}

test pretty-1.1 {Basic pretty-print} -body { #<<<
json pretty {{"foo":null,"empty":{},"emptyarr":[],"hello, world":"bar","This is a much longer key":["str",123,123.4,true,false,null,{"inner": "obj"}]}}
Expand Down
3 changes: 1 addition & 2 deletions tests/set.test
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ if {"::tcltest" ni [namespace children]} {
}

package require rl_json
package require parse_args
namespace path {::rl_json ::parse_args}
namespace path {::rl_json}

source [file join [file dirname [info script]] helpers.tcl]

Expand Down
3 changes: 1 addition & 2 deletions tests/unset.test
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ if {"::tcltest" ni [namespace children]} {
}

package require rl_json
package require parse_args
namespace path {::rl_json ::parse_args}
namespace path {::rl_json}

source [file join [file dirname [info script]] helpers.tcl]

Expand Down