diff options
author | pooryorick <com.digitalsmarties@pooryorick.com> | 2019-10-26 15:43:35 (GMT) |
---|---|---|
committer | pooryorick <com.digitalsmarties@pooryorick.com> | 2019-10-26 15:43:35 (GMT) |
commit | c5aa761ded9c2393fe0eed72176f82e0d76235c9 (patch) | |
tree | f6458a47de9e3244d34031bdaa6b7fe94dc9f347 /tests/fileSystemEncoding.test | |
parent | 71c3d83e9d0779c6c278840a665c7396e5bc8caf (diff) | |
download | tcl-c5aa761ded9c2393fe0eed72176f82e0d76235c9.zip tcl-c5aa761ded9c2393fe0eed72176f82e0d76235c9.tar.gz tcl-c5aa761ded9c2393fe0eed72176f82e0d76235c9.tar.bz2 |
Test for issue [bcd1004104651], and new routine, ::tcltests::tempdir.
Diffstat (limited to 'tests/fileSystemEncoding.test')
-rw-r--r-- | tests/fileSystemEncoding.test | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/tests/fileSystemEncoding.test b/tests/fileSystemEncoding.test new file mode 100644 index 0000000..12683b2 --- /dev/null +++ b/tests/fileSystemEncoding.test @@ -0,0 +1,47 @@ +#! /usr/bin/env tclsh + +# Copyright (c) 2019 Poor Yorick + +namespace eval ::tcl::test::fileSystemEncoding { + package require tcltest 2 + namespace import ::tcltest::* + + variable fname1 \u767b\u9e1b\u9d72\u6a13 + + proc autopath {} { + global auto_path + set scriptpath [info script] + set scriptpathnorm [file dirname [file normalize $scriptpath/...]] + set dirnorm [file dirname $scriptpathnorm] + set idx [lsearch -exact $auto_path $dirnorm] + if {$idx >= 0} { + set auto_path [lreplace $auto_path[set auto_path {}] $idx $idx {}] + } + set auto_path [linsert $auto_path[set auto_path {}] 0 0 $dirnorm] + } + autopath + + package require tcltests + + test filesystemEncoding-1.0 { + issue bcd100410465 + } -body { + set dir [tcltests::tempdir] + set saved [encoding system] + encoding system iso8859-1 + set fname1a $dir/$fname1 + set utf8name [encoding convertto utf-8 $fname1a] + makeFile {} $utf8name + set globbed [lindex [glob -directory $dir *] 0] + encoding system utf-8 + lappend res [file exists $globbed] + encoding system iso8859-1 + lappend res [file exists $globbed] + return $res + } -cleanup { + file delete -force $dir + encoding system $saved + } -result {0 1} + + cleanupTests +} |