From 10f2db01776937d715289e45097eaca7b7e2ef0b Mon Sep 17 00:00:00 2001 From: Thomas Perschak Date: Thu, 6 Nov 2025 00:06:52 +0100 Subject: [PATCH] parse_args fails to load during tests, simplify as it seems it's anyhow overkill for this --- tests/helpers.tcl | 21 ++++++++------------- tests/number.test | 4 ++-- tests/pretty.test | 3 +-- tests/set.test | 3 +-- tests/unset.test | 3 +-- 5 files changed, 13 insertions(+), 21 deletions(-) diff --git a/tests/helpers.tcl b/tests/helpers.tcl index 13ae0cb..d5ce82e 100644 --- a/tests/helpers.tcl +++ b/tests/helpers.tcl @@ -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 + } } #>>> diff --git a/tests/number.test b/tests/number.test index 5d5eda8..bf4ac1c 100644 --- a/tests/number.test +++ b/tests/number.test @@ -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 diff --git a/tests/pretty.test b/tests/pretty.test index 1bd6e51..4215b50 100644 --- a/tests/pretty.test +++ b/tests/pretty.test @@ -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"}]}} diff --git a/tests/set.test b/tests/set.test index ce5d737..8da79bb 100644 --- a/tests/set.test +++ b/tests/set.test @@ -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] diff --git a/tests/unset.test b/tests/unset.test index 1f0dc34..beb76d9 100644 --- a/tests/unset.test +++ b/tests/unset.test @@ -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]