2 # This file describes the usage of the Tesh variables and contains all the tests connected.
4 # Description of this tesh suite
5 D Usage of tesh variables
7 # Declare and define the variable include-file
8 ! include-file=catch-signal.tesh
10 # include the tesh file specified by the value (catch-signal.tesh) of the variable include-file
11 ! include $include-file
13 # set a new value to the variable include-file
14 ! include-file=basic.tesh
16 # this line throws a warning (you assign the same value to the variable)
17 ! include-file=basic.tesh
19 # include the tesh file specified by the value (basic.tesh) of the variable include-file
20 ! include $include-file
23 ! expect return $ESYNTAX
25 < ! include $include-file
26 $ ./tesh --log='log.thresh:info tesh.fmt:%m%n'
27 > Test unit from stdin
28 > [stdin:1] Undefined variable `(include-file)'
29 > Test unit `(stdin)' : NOK (syntax error)
32 # A single sample of the usage of the tesh variables
40 < int main(int argc, char* argv[]) {
41 < return ( atoi(argv[1]) + atoi(argv[2]));
58 # set metacommand usage
60 # This ligne add a new tesh variable DIR
62 ! set DIR=temp_testdir
74 # This ligne change the value of the tesh variable DIR
75 ! set DIR=test_tempdir
77 # This ligne # this line throws a warning (you assign the same value to the variable)
78 ! set DIR=test_tempdir
81 # This ligne create a new variable CURRENT_DIR (setted with the content of the variable DIR)
83 p CURRENT_DIR is $CURRENT_DIR (same value as DIR)
85 # This ligne use the metacommand `set' to update the content of the variable CURRENT_DIR
86 ! set CURRENT_DIR=temp_testdir
87 p Now CURRENT_DIR is $CURRENT_DIR
89 # This ligne unset the variable CURRENT_DIR (delete the tesh variable)
91 p $CURRENT_DIR does not exist
93 # This ligne displays the content of the environment variable TESH_PPID (which contains the PID of the tesh parent)
94 p The Tesh parent PID is: $TESH_PPID
96 # This ligne displays the content of the value of the system variable ENOENT
97 p On this platform ENOENT is: $ENOENT
99 # Attempt to change the content of a system variable is a syntax error
100 ! expect return $ESYNTAX
103 $ ./tesh --log='log.thresh:info tesh.fmt:%m%n'
104 > Test unit from stdin
105 > [stdin:1] A system variable named `(ENOENT)' already exists
106 > Test unit `(stdin)' : NOK (syntax error)