summaryrefslogtreecommitdiffstats
path: root/tests/fileSystemEncoding.test
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2019-11-04 12:10:54 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2019-11-04 12:10:54 (GMT)
commit2b8429142401960e12bcece0205061dd68071ded (patch)
treea3561a9d8e8c9b868ed9b209b444e7f78e8d38d3 /tests/fileSystemEncoding.test
parentefe1dce70b548e0af9d8a0e0e6cffbca6faa2cb5 (diff)
parent493585e80285a37fffbfa04f560a2d37a94d3322 (diff)
downloadtcl-2b8429142401960e12bcece0205061dd68071ded.zip
tcl-2b8429142401960e12bcece0205061dd68071ded.tar.gz
tcl-2b8429142401960e12bcece0205061dd68071ded.tar.bz2
Merge 8.7
Diffstat (limited to 'tests/fileSystemEncoding.test')
-rw-r--r--tests/fileSystemEncoding.test51
1 files changed, 51 insertions, 0 deletions
diff --git a/tests/fileSystemEncoding.test b/tests/fileSystemEncoding.test
new file mode 100644
index 0000000..fa67646
--- /dev/null
+++ b/tests/fileSystemEncoding.test
@@ -0,0 +1,51 @@
+#! /usr/bin/env tclsh
+
+# Copyright (c) 2019 Poor Yorick
+
+if {[string equal $::tcl_platform(os) "Windows NT"]} {
+ return
+}
+
+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
+}