Check-in [4d98220463]

Login
Bounty program for improvements to Tcl and certain Tcl packages.
Tcl 2019 Conference, Houston/TX, US, Nov 4-8
Send your abstracts to [email protected]
or submit via the online form by Sep 9.

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Editorial fixes
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 4d982204638cd616041a61a721186f539fbad9ecea4dd41c4c5c0117d0353534
User & Date: dkf 2018-10-24 18:09:23
Context
2018-10-24
18:13
Added another example usage, simpler than the minor contortion required for Tcl itself. check-in: d1be9d5c9f user: dkf tags: trunk
18:09
Editorial fixes check-in: 4d98220463 user: dkf tags: trunk
13:24
CFV on 525 by DKF check-in: f59be0ac7d user: dkf tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to tip/522.md.

23
24
25
26
27
28
29
30
31
32
33
34
35

36
37
38
39
40


41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
However, testing them is a bit clunky and few commands have tests for them.

The most obvious test usage for them are exact matching and prefix matching,
both easily done with a glob pattern since error codes do not have special
characters.

Having an error code check without requiring return code error makes no sense
so as a convenience -returnCodes 1 is set if not present. A user that for some
reason wants to allow more than 1 may still do so.

# Specification

Add a new option, -errorCode, to the test command in tcltest.

This is a glob pattern and defaults to "*".
When an error occurs in the body evaluation the pattern is tested
against the error code from test execution.
When -errorCode is given, and -returnCodes does not include 1, -returnCodes
is set to 1.



# Example

This

	test dict-4.13 {dict replace command: type check is mandatory} -body {
	    dict replace { a b c d e }
	} -returnCodes error -result {missing value to go with key}
	test dict-4.13a {dict replace command: type check is mandatory} {
	    catch {dict replace { a b c d e }} -> opt
	    dict get $opt -errorcode
	} {TCL VALUE DICTIONARY}

is replaced by this

	test dict-4.13 {dict replace command: type check is mandatory} -body {
	    dict replace { a b c d e }
	} -errorCode {TCL VALUE DICTIONARY} -result {missing value to go with key}

# Copyright

This document has been placed in the public domain.






|




|
>
|
|

<
|
>
>



|









|








23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39

40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
However, testing them is a bit clunky and few commands have tests for them.

The most obvious test usage for them are exact matching and prefix matching,
both easily done with a glob pattern since error codes do not have special
characters.

Having an error code check without requiring return code error makes no sense
so as a convenience `-returnCodes 1` is set if not present. A user that for some
reason wants to allow more than 1 may still do so.

# Specification

Add a new option, **-errorCode**, to the **test** command in the
**tcltest** package.
This is a glob pattern and defaults to "`*`".
When an error occurs in the body evaluation, the pattern is tested
against the error code from test execution.

When **-errorCode** is given, and **-returnCodes** does not include
`1` (or `error`, equivalently) so it is impossible for a valid error
code to be generated, **-returnCodes** is set to `1`.

# Example

This:

	test dict-4.13 {dict replace command: type check is mandatory} -body {
	    dict replace { a b c d e }
	} -returnCodes error -result {missing value to go with key}
	test dict-4.13a {dict replace command: type check is mandatory} {
	    catch {dict replace { a b c d e }} -> opt
	    dict get $opt -errorcode
	} {TCL VALUE DICTIONARY}

is replaced by this:

	test dict-4.13 {dict replace command: type check is mandatory} -body {
	    dict replace { a b c d e }
	} -errorCode {TCL VALUE DICTIONARY} -result {missing value to go with key}

# Copyright

This document has been placed in the public domain.

Changes to tip/525.md.

15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
..
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
environment (such as [Travis](https://travis-ci.org/) or
[Appveyor](https://www.appveyor.com/)) by making `tcltest::runAllTests` return
a boolean indicator of success or failure.

# Rationale and Specification

The Tcl test suite is great, but when a failure happens it reports success to
its environment (by effectively doing an `exit 0`) which mans that there's no
way to tell at the wider level whether the tests passed or failed except by
manually inspecting the logs, which is a manual process that prevents the Tcl
test suite from being used in an automated environment such as a continuous
integration system.

This TIP changes this by making `tcltest::runAllTests` return a boolean
(instead of the empty string) that reports whether the executed tests all
................................................................................
to set the `ERROR_ON_FAILURES` environment variable in order to get this
additional behaviour at the outer level, so only an environment that is
prepared to deal with the consequences will notice.)

# Implementation

See the branches `travis-8.5`, `travis-8.6`, `travis-8.7` and `travis-9.0`;
this TIP is specifically altering the procdure `runAllTests` to include
exactly one more line at the end:

    return [expr {[info exists testFileFailures] || [llength $failFiles]}]

This is exactly the condition for Tcltest to report a failing test file (the
existence of `testFileFailures`) or a file with a failing test (`$failFiles`
being non-empty).

# Copyright

This document has been placed in the public domain.






|







 







|











15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
..
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
environment (such as [Travis](https://travis-ci.org/) or
[Appveyor](https://www.appveyor.com/)) by making `tcltest::runAllTests` return
a boolean indicator of success or failure.

# Rationale and Specification

The Tcl test suite is great, but when a failure happens it reports success to
its environment (by effectively doing an `exit 0`) which means that there's no
way to tell at the wider level whether the tests passed or failed except by
manually inspecting the logs, which is a manual process that prevents the Tcl
test suite from being used in an automated environment such as a continuous
integration system.

This TIP changes this by making `tcltest::runAllTests` return a boolean
(instead of the empty string) that reports whether the executed tests all
................................................................................
to set the `ERROR_ON_FAILURES` environment variable in order to get this
additional behaviour at the outer level, so only an environment that is
prepared to deal with the consequences will notice.)

# Implementation

See the branches `travis-8.5`, `travis-8.6`, `travis-8.7` and `travis-9.0`;
this TIP is specifically altering the procedure `runAllTests` to include
exactly one more line at the end:

    return [expr {[info exists testFileFailures] || [llength $failFiles]}]

This is exactly the condition for Tcltest to report a failing test file (the
existence of `testFileFailures`) or a file with a failing test (`$failFiles`
being non-empty).

# Copyright

This document has been placed in the public domain.