From da82368c816c8d06f425aa3f25a2a918fdba1df1 Mon Sep 17 00:00:00 2001 From: Steve Bennett Date: Sat, 18 Apr 2020 09:34:25 +1000 Subject: tests: Add many new additional tests for code coverage readdir, tty, utf8, signal, alarm, kill, file, jimsh, posix, aio, history, interp, pack, unpack, eventloop, exec, load, package, regexp, regsub Signed-off-by: Steve Bennett --- tests/dict2.test | 32 +++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) (limited to 'tests/dict2.test') diff --git a/tests/dict2.test b/tests/dict2.test index 54d4d0d..f4d147a 100644 --- a/tests/dict2.test +++ b/tests/dict2.test @@ -95,7 +95,7 @@ test dict-3.10 {dict get command} -returnCodes error -body { test dict-3.11 {dict get command} {dict get [dict create a b c d] a} b test dict-3.12 {dict get command} -returnCodes error -body { dict get -} -result {wrong # args: should be "dict get dictionary ?key ...?"} +} -match glob -result {wrong # args: should be "dict get dictionary ?key*?"} test dict-3.13 {dict get command} -body { set dict [dict get {a b c d}] if {$dict eq "a b c d"} { @@ -1250,5 +1250,35 @@ test dict-22.11 {dict with command: no recursive structures [Bug 1786481]} -body } -cleanup { unset foo t inner } -result OK + +set dictnulls {ab\0c de\0f \0ghi kl\0m} +set dictgood [array get tcl_platform] +set dictbad {abc def ghi} + +test dict-23.1 {dict info} { + regexp {entries in table,.*buckets} [dict info $dictgood] +} {1} + +test dict-23.2 {dict info usage} -body { + dict info +} -returnCodes error -result {wrong # args: should be "dict info dictionary"} + +test dict-23.3 {dict info baddict} -body { + dict info $dictbad +} -returnCodes error -result {missing value to go with key} + +test dict-23.4 {dict with usage} -body { + dict with +} -returnCodes error -result {wrong # args: should be "dict with dictVar ?key ...? script"} + +test dict-23.5 {dict with badvar} -constraints jim -body { + # set up a variable that will fail Jim_SetVariable() + dict with dictnulls {} +} -returnCodes error -result {variable name contains embedded null} + +test dict-23.6 {dict with baddict} -body { + dict with dictbad {} +} -returnCodes error -result {missing value to go with key} + testreport -- cgit v1.1