diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2023-01-31 07:49:16 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2023-01-31 07:49:16 (GMT) |
commit | 64e3a23bfdcfbe7b66872c58d095aa6e1868f95e (patch) | |
tree | ab9ab0930e901eb23d8d07e261cfa010ca3e0a71 | |
parent | d3dae9eba4c8d979d72feddfded60eb08835543d (diff) | |
download | tcl-64e3a23bfdcfbe7b66872c58d095aa6e1868f95e.zip tcl-64e3a23bfdcfbe7b66872c58d095aa6e1868f95e.tar.gz tcl-64e3a23bfdcfbe7b66872c58d095aa6e1868f95e.tar.bz2 |
SetFlag -> GotFlag (since SetFlag always returns 1, this is nonsence in an if() statement). Also add test-case, showing that it was actually wrong, in behavior too.
-rw-r--r-- | generic/tclIO.c | 2 | ||||
-rw-r--r-- | tests/ioCmd.test | 10 |
2 files changed, 11 insertions, 1 deletions
diff --git a/generic/tclIO.c b/generic/tclIO.c index 47040d5..fed469c 100644 --- a/generic/tclIO.c +++ b/generic/tclIO.c @@ -8354,7 +8354,7 @@ Tcl_SetChannelOption( #ifdef TCL_NO_DEPRECATED ResetFlag(statePtr, CHANNEL_ENCODING_NOCOMPLAIN); #else - if (SetFlag(statePtr, CHANNEL_ENCODING_STRICT)) { + if (GotFlag(statePtr, CHANNEL_ENCODING_STRICT) != CHANNEL_ENCODING_STRICT) { if (interp) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "bad value for -nocomplainencoding: only true allowed", diff --git a/tests/ioCmd.test b/tests/ioCmd.test index 73f0e1c..1a72f70 100644 --- a/tests/ioCmd.test +++ b/tests/ioCmd.test @@ -376,6 +376,16 @@ test iocmd-8.21 {fconfigure command / -nocomplainencoding 0 error} -constraints } -body { fconfigure $console -nocomplainencoding 0 } -returnCodes error -result "bad value for -nocomplainencoding: only true allowed" +test iocmd-8.22 {fconfigure command / -nocomplainencoding 0, no error if -strictencoding already defined} -setup { + set console stdin + set oldmode [fconfigure $console -strictencoding] +} -body { + fconfigure $console -strictencoding 1 + fconfigure $console -nocomplainencoding 0 + fconfigure $console -nocomplainencoding +} -cleanup { + fconfigure $console -strictencoding $oldmode +} -result 0 test iocmd-9.1 {eof command} { |