summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2015-10-25 22:00:54 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2015-10-25 22:00:54 (GMT)
commit820c13e4bd18805cf590e0fa0e1627e7ecf92ec4 (patch)
tree44adfb486b7d1a745d56daa95b597a89e4b0fb7c /tests
parent319c8c27a5ca698c35293ea586e638f46a79c579 (diff)
downloadtk-820c13e4bd18805cf590e0fa0e1627e7ecf92ec4.zip
tk-820c13e4bd18805cf590e0fa0e1627e7ecf92ec4.tar.gz
tk-820c13e4bd18805cf590e0fa0e1627e7ecf92ec4.tar.bz2
Fix [477949]: option readfile cannot use multibytes.
Implementation adopted from AndroWish, but added support for UTF-8 BOM and added test-case.
Diffstat (limited to 'tests')
-rwxr-xr-xtests/option.file318
-rw-r--r--tests/option.test11
2 files changed, 25 insertions, 4 deletions
diff --git a/tests/option.file3 b/tests/option.file3
new file mode 100755
index 0000000..87f41ae
--- /dev/null
+++ b/tests/option.file3
@@ -0,0 +1,18 @@
+! This file is a sample option (resource) database used to test
+! Tk's option-handling capabilities.
+
+! Comment line \
+ with a backslash-newline sequence embedded in it.
+
+*x1: blue
+ tktest.x2 : green
+*\
+x3 \
+ : pur\
+ple
+*x 4: brówn
+# More comments, this time delimited by hash-marks.
+ # Comment-line with space.
+*x6:
+*x9: \ \ \\\101\n
+# comment line as last line of file.
diff --git a/tests/option.test b/tests/option.test
index 1bfcb7c..4668771 100644
--- a/tests/option.test
+++ b/tests/option.test
@@ -187,6 +187,7 @@ test option-14.12 {error conditions} {
set option1 [file join [testsDirectory] option.file1]
set option2 [file join [testsDirectory] option.file2]
+set option3 [file join [testsDirectory] option.file3]
test option-15.1 {database files} {
list [catch {option read non-existent} msg] $msg
@@ -207,16 +208,18 @@ test option-15.9 {database files} {option get . x3 color} burgundy
test option-15.10 {database files} {
list [catch {option read $option2} msg] $msg
} {1 {missing colon on line 2}}
+option read $option3
+test option-15.11 {database files} {option get . {x 4} color} br\xf3wn
test option-16.1 {ReadOptionFile} {
- set option3 [makeFile {} option.file3]
- set file [open $option3 w]
+ set option4 [makeFile {} option.file3]
+ set file [open $option4 w]
fconfigure $file -translation crlf
puts $file "*x7: true\n*x8: false"
close $file
- option read $option3 userDefault
+ option read $option4 userDefault
set result [list [option get . x7 color] [option get . x8 color]]
- removeFile $option3
+ removeFile $option4
set result
} {true false}