From 2a1443e0e07d217161b094cf6e550f63ef2cab54 Mon Sep 17 00:00:00 2001 From: dgp Date: Mon, 14 Nov 2022 17:23:52 +0000 Subject: Test suite hygiene - Several tests missing the "testdstring" constraint - [package require tcltests] is fragile, and almost all test files that had it were not making use of anything it provides. Removed. --- tests/chanio.test | 1 - tests/env.test | 2 -- tests/exec.test | 2 -- tests/io.test | 1 - tests/ioCmd.test | 2 -- tests/platform.test | 1 - tests/thread.test | 3 ++- tests/util.test | 10 +++++----- 8 files changed, 7 insertions(+), 15 deletions(-) diff --git a/tests/chanio.test b/tests/chanio.test index 5381a88..0f45819 100644 --- a/tests/chanio.test +++ b/tests/chanio.test @@ -34,7 +34,6 @@ namespace eval ::tcl::test::io { package require -exact Tcltest [info patchlevel] set ::tcltestlib [lindex [package ifneeded Tcltest [info patchlevel]] 1] } - package require tcltests testConstraint testbytestring [llength [info commands testbytestring]] testConstraint testchannel [llength [info commands testchannel]] diff --git a/tests/env.test b/tests/env.test index ff111e9..6c46532 100644 --- a/tests/env.test +++ b/tests/env.test @@ -16,8 +16,6 @@ if {"::tcltest" ni [namespace children]} { namespace import -force ::tcltest::* } -package require tcltests - # [exec] is required here to see the actual environment received by child # processes. proc getenv {} { diff --git a/tests/exec.test b/tests/exec.test index 0f5db76..4cc4a05 100644 --- a/tests/exec.test +++ b/tests/exec.test @@ -19,8 +19,6 @@ if {"::tcltest" ni [namespace children]} { namespace import -force ::tcltest::* } -package require tcltests - # All tests require the "exec" command. # Skip them if exec is not defined. testConstraint exec [llength [info commands exec]] diff --git a/tests/io.test b/tests/io.test index 94d8764..cd4c954 100644 --- a/tests/io.test +++ b/tests/io.test @@ -34,7 +34,6 @@ namespace eval ::tcl::test::io { package require -exact Tcltest [info patchlevel] set ::tcltestlib [lindex [package ifneeded Tcltest [info patchlevel]] 1] } - package require tcltests testConstraint testbytestring [llength [info commands testbytestring]] testConstraint testchannel [llength [info commands testchannel]] diff --git a/tests/ioCmd.test b/tests/ioCmd.test index 898d076..99bb464 100644 --- a/tests/ioCmd.test +++ b/tests/ioCmd.test @@ -21,8 +21,6 @@ if {"::tcltest" ni [namespace children]} { ::tcltest::loadTestedCommands catch [list package require -exact Tcltest [info patchlevel]] -package require tcltests - # Custom constraints used in this file testConstraint testchannel [llength [info commands testchannel]] diff --git a/tests/platform.test b/tests/platform.test index 042469b..6b775cf 100644 --- a/tests/platform.test +++ b/tests/platform.test @@ -10,7 +10,6 @@ # of this file, and for a DISCLAIMER OF ALL WARRANTIES. package require tcltest 2.5 -package require tcltests namespace eval ::tcl::test::platform { namespace import ::tcltest::testConstraint diff --git a/tests/thread.test b/tests/thread.test index 7c7dc27..28934a2 100644 --- a/tests/thread.test +++ b/tests/thread.test @@ -15,7 +15,8 @@ # when thread::release is used, -wait is passed in order allow the thread to # be fully finalized, which avoids valgrind "still reachable" reports. -package require tcltests +package require tcltest 2.5 +namespace import ::tcltest::* ::tcltest::loadTestedCommands catch [list package require -exact Tcltest [info patchlevel]] diff --git a/tests/util.test b/tests/util.test index d0b98a5..11ee3fa 100644 --- a/tests/util.test +++ b/tests/util.test @@ -528,7 +528,7 @@ test util-8.6 {TclNeedSpace - correct utf-8 handling} testdstring { testdstring append \} -1 list [llength [testdstring get]] [string length [testdstring get]] } {2 8} -test util-8.7 {TclNeedSpace - watch out for escaped space} { +test util-8.7 {TclNeedSpace - watch out for escaped space} testdstring { testdstring free testdstring append {\ } -1 testdstring start @@ -537,7 +537,7 @@ test util-8.7 {TclNeedSpace - watch out for escaped space} { # Should make {\ {}} list [llength [testdstring get]] [string index [testdstring get] 3] } {2 \{} -test util-8.8 {TclNeedSpace - watch out for escaped space} { +test util-8.8 {TclNeedSpace - watch out for escaped space} testdstring { testdstring free testdstring append {\\ } -1 testdstring start @@ -546,7 +546,7 @@ test util-8.8 {TclNeedSpace - watch out for escaped space} { # Should make {\\ {}} list [llength [testdstring get]] [string index [testdstring get] 3] } {2 \{} -test util-8.9 {TclNeedSpace - watch out for escaped space} { +test util-8.9 {TclNeedSpace - watch out for escaped space} testdstring { testdstring free testdstring append {\\\ } -1 testdstring start @@ -555,7 +555,7 @@ test util-8.9 {TclNeedSpace - watch out for escaped space} { # Should make {\\\ {}} list [llength [testdstring get]] [string index [testdstring get] 5] } {2 \{} -test util-8.10 {TclNeedSpace - watch out for escaped space} { +test util-8.10 {TclNeedSpace - watch out for escaped space} testdstring { testdstring free testdstring append {\\\\\\\ } -1 testdstring start @@ -564,7 +564,7 @@ test util-8.10 {TclNeedSpace - watch out for escaped space} { # Should make {\\\\\\\ {}} list [llength [testdstring get]] [string index [testdstring get] 9] } {2 \{} -test util-8.11 {TclNeedSpace - watch out for escaped space} { +test util-8.11 {TclNeedSpace - watch out for escaped space} testdstring { testdstring free testdstring append {\\\\\\\\ } -1 testdstring start -- cgit v0.12