summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/chanio.test6
-rw-r--r--tests/coroutine.test39
-rw-r--r--tests/format.test40
-rw-r--r--tests/io.test4
-rw-r--r--tests/scan.test15
-rw-r--r--tests/zlib.test2
6 files changed, 75 insertions, 31 deletions
diff --git a/tests/chanio.test b/tests/chanio.test
index 31bef36..db2475c 100644
--- a/tests/chanio.test
+++ b/tests/chanio.test
@@ -5338,7 +5338,7 @@ test chan-io-40.2 {POSIX open access modes: CREAT} -setup {
} -constraints {unix} -body {
set f [open $path(test3) {WRONLY CREAT} 0600]
file stat $path(test3) stats
- set x [format "0%o" [expr $stats(mode)&0o777]]
+ set x [format "%#o" [expr $stats(mode)&0o777]]
chan puts $f "line 1"
chan close $f
set f [open $path(test3) r]
@@ -5352,8 +5352,8 @@ test chan-io-40.3 {POSIX open access modes: CREAT} -setup {
# This test only works if your umask is 2, like ouster's.
chan close [open $path(test3) {WRONLY CREAT}]
file stat $path(test3) stats
- format "0%o" [expr $stats(mode)&0o777]
-} -result [format %04o [expr {0o666 & ~ $umaskValue}]]
+ format "%#o" [expr $stats(mode)&0o777]
+} -result [format %#4o [expr {0o666 & ~ $umaskValue}]]
test chan-io-40.4 {POSIX open access modes: CREAT} -setup {
file delete $path(test3)
} -body {
diff --git a/tests/coroutine.test b/tests/coroutine.test
index 205da67..fd68567 100644
--- a/tests/coroutine.test
+++ b/tests/coroutine.test
@@ -741,6 +741,45 @@ test coroutine-7.12 {coro floor above street level #3008307} -body {
list
} -result {}
+test coroutine-8.0.0 {coro inject executed} -body {
+ coroutine demo apply {{} { foreach i {1 2} yield }}
+ demo
+ set ::result none
+ tcl::unsupported::inject demo set ::result inject-executed
+ demo
+ set ::result
+} -result {inject-executed}
+test coroutine-8.0.1 {coro inject after error} -body {
+ coroutine demo apply {{} { foreach i {1 2} yield; error test }}
+ demo
+ set ::result none
+ tcl::unsupported::inject demo set ::result inject-executed
+ lappend ::result [catch {demo} err] $err
+} -result {inject-executed 1 test}
+test coroutine-8.1.1 {coro inject, ticket 42202ba1e5ff566e} -body {
+ interp create slave
+ slave eval {
+ coroutine demo apply {{} { while {1} yield }}
+ demo
+ tcl::unsupported::inject demo set ::result inject-executed
+ }
+ interp delete slave
+} -result {}
+test coroutine-8.1.2 {coro inject with result, ticket 42202ba1e5ff566e} -body {
+ interp create slave
+ slave eval {
+ coroutine demo apply {{} { while {1} yield }}
+ demo
+ tcl::unsupported::inject demo set ::result inject-executed
+ }
+ slave eval demo
+ set result [slave eval {set ::result}]
+
+ interp delete slave
+ set result
+} -result {inject-executed}
+
+
# cleanup
unset lambda
diff --git a/tests/format.test b/tests/format.test
index dbf6af0..9afedd9 100644
--- a/tests/format.test
+++ b/tests/format.test
@@ -52,32 +52,32 @@ test format-1.7.1 {integer formatting} longIs64bit {
format "%4x %4x %4x %4x" 6 34 16923 -12 -1
} { 6 22 421b fffffffffffffff4}
test format-1.8 {integer formatting} longIs32bit {
- format "%#x %#X %#X %#x" 6 34 16923 -12 -1
-} {0x6 0X22 0X421B 0xfffffff4}
+ format "%#x %#x %#X %#X %#x" 0 6 34 16923 -12 -1
+} {0x0 0x6 0X22 0X421B 0xfffffff4}
test format-1.8.1 {integer formatting} longIs64bit {
- format "%#x %#X %#X %#x" 6 34 16923 -12 -1
-} {0x6 0X22 0X421B 0xfffffffffffffff4}
+ format "%#x %#x %#X %#X %#x" 0 6 34 16923 -12 -1
+} {0x0 0x6 0X22 0X421B 0xfffffffffffffff4}
test format-1.9 {integer formatting} longIs32bit {
- format "%#20x %#20x %#20x %#20x" 6 34 16923 -12 -1
-} { 0x6 0x22 0x421b 0xfffffff4}
+ format "%#5x %#20x %#20x %#20x %#20x" 0 6 34 16923 -12 -1
+} { 0x0 0x6 0x22 0x421b 0xfffffff4}
test format-1.9.1 {integer formatting} longIs64bit {
- format "%#20x %#20x %#20x %#20x" 6 34 16923 -12 -1
-} { 0x6 0x22 0x421b 0xfffffffffffffff4}
+ format "%#5x %#20x %#20x %#20x %#20x" 0 6 34 16923 -12 -1
+} { 0x0 0x6 0x22 0x421b 0xfffffffffffffff4}
test format-1.10 {integer formatting} longIs32bit {
- format "%-#20x %-#20x %-#20x %-#20x" 6 34 16923 -12 -1
-} {0x6 0x22 0x421b 0xfffffff4 }
+ format "%-#5x %-#20x %-#20x %-#20x %-#20x" 0 6 34 16923 -12 -1
+} {0x0 0x6 0x22 0x421b 0xfffffff4 }
test format-1.10.1 {integer formatting} longIs64bit {
- format "%-#20x %-#20x %-#20x %-#20x" 6 34 16923 -12 -1
-} {0x6 0x22 0x421b 0xfffffffffffffff4 }
+ format "%-#5x %-#20x %-#20x %-#20x %-#20x" 0 6 34 16923 -12 -1
+} {0x0 0x6 0x22 0x421b 0xfffffffffffffff4 }
test format-1.11 {integer formatting} longIs32bit {
- format "%-#20o %#-20o %#-20o %#-20o" 6 34 16923 -12 -1
-} {06 042 041033 037777777764 }
+ format "%-#5o %-#20o %#-20o %#-20o %#-20o" 0 6 34 16923 -12 -1
+} {0 06 042 041033 037777777764 }
test format-1.11.1 {integer formatting} longIs64bit {
- format "%-#20o %#-20o %#-20o %#-20o" 6 34 16923 -12 -1
-} {06 042 041033 01777777777777777777764}
+ format "%-#5o %-#20o %#-20o %#-20o %#-20o" 0 6 34 16923 -12 -1
+} {0 06 042 041033 01777777777777777777764}
test format-1.12 {integer formatting} {
- format "%b %#b %llb" 5 5 [expr {2**100}]
-} {101 0b101 10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000}
+ format "%b %#b %#b %llb" 5 0 5 [expr {2**100}]
+} {101 0b0 0b101 10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000}
test format-2.1 {string formatting} {
format "%s %s %c %s" abcd {This is a very long test string.} 120 x
@@ -528,9 +528,9 @@ test format-17.3 {testing %ld with non-wide} {wideIs64bit} {
test format-17.4 {testing %l with non-integer} {
format %lf 1
} 1.000000
-test format-17.5 {testing %llu with bignum} {
+test format-17.5 {testing %llu with positive bignum} -body {
format %llu 0xabcdef0123456789abcdef
-} 207698809136909011942886895
+} -returnCodes 1 -result {unsigned bignum format is invalid}
test format-17.6 {testing %llu with negative number} -body {
format %llu -1
} -returnCodes 1 -result {unsigned bignum format is invalid}
diff --git a/tests/io.test b/tests/io.test
index e2a05dc..197fc36 100644
--- a/tests/io.test
+++ b/tests/io.test
@@ -5652,8 +5652,8 @@ test io-40.3 {POSIX open access modes: CREAT} {unix umask} {
set f [open $path(test3) {WRONLY CREAT}]
close $f
file stat $path(test3) stats
- format "0%o" [expr $stats(mode)&0o777]
-} [format %04o [expr {0o666 & ~ $umaskValue}]]
+ format "%#o" [expr $stats(mode)&0o777]
+} [format %#4o [expr {0o666 & ~ $umaskValue}]]
test io-40.4 {POSIX open access modes: CREAT} {
file delete $path(test3)
set f [open $path(test3) w]
diff --git a/tests/scan.test b/tests/scan.test
index 8ddb595..b36b412 100644
--- a/tests/scan.test
+++ b/tests/scan.test
@@ -542,18 +542,23 @@ test scan-5.16 {Bug be003d570f} {
scan 0x40 %b
} 0
test scan-5.17 {bigint scanning} -setup {
- set a {}; set b {}; set c {}; set d {}
+ set a {}; set b {}; set c {}
} -body {
- list [scan "207698809136909011942886895,207698809136909011942886895,abcdef0123456789abcdef,125715736004432126361152746757" \
- %llu,%lld,%llx,%llo a b c d] $a $b $c $d
-} -result {4 207698809136909011942886895 207698809136909011942886895 207698809136909011942886895 207698809136909011942886895}
+ list [scan "207698809136909011942886895,abcdef0123456789abcdef,125715736004432126361152746757" \
+ %lld,%llx,%llo a b c] $a $b $c
+} -result {3 207698809136909011942886895 207698809136909011942886895 207698809136909011942886895}
test scan-5.18 {bigint scanning underflow} -setup {
set a {};
} -body {
list [scan "-207698809136909011942886895" \
%llu a] $a
} -returnCodes 1 -result {unsigned bignum scans are invalid}
-
+test scan-5.18 {bigint scanning invalid} -setup {
+ set a {};
+} -body {
+ list [scan "207698809136909011942886895" \
+ %llu a] $a
+} -returnCodes 1 -result {unsigned bignum scans are invalid}
test scan-6.1 {floating-point scanning} -setup {
set a {}; set b {}; set c {}; set d {}
diff --git a/tests/zlib.test b/tests/zlib.test
index 9f06eb1..c2f7825 100644
--- a/tests/zlib.test
+++ b/tests/zlib.test
@@ -1004,7 +1004,7 @@ test zlib-12.2 {Patrick Dunnigan's issue} -constraints zlib -setup {
} -cleanup {
removeFile $filesrc
removeFile $filedst
-} -result 4152
+} -result 56
::tcltest::cleanupTests
return