Fix typo in reference manual
[dejagnu.git] / testsuite / runtest.libs / testcase_group.test
blobff8e9417fc31643454c90cb62d78197f7f55ff9e
1 # test "testcase group" API call                                -*- Tcl -*-
3 # Copyright (C) 2020 Free Software Foundation, Inc.
5 # This file is part of DejaGnu.
7 # DejaGnu is free software: you can redistribute it and/or modify it
8 # under the terms of the GNU General Public License as published by
9 # the Free Software Foundation, either version 3 of the License, or
10 # (at your option) any later version.
12 # DejaGnu is distributed in the hope that it will be useful, but
13 # WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15 # General Public License for more details.
17 # You should have received a copy of the GNU General Public License
18 # along with DejaGnu.  If not, see <http://www.gnu.org/licenses/>.
20 if [ file exists $srcdir/$subdir/default_procs.tcl ] {
21     source "$srcdir/$subdir/default_procs.tcl"
22 } else {
23     puts "ERROR: $srcdir/$subdir/default_procs.tcl doesn't exist"
25 if [ file exists $srcdir/../lib/framework.exp] {
26     source $srcdir/../lib/framework.exp
27 } else {
28     puts "ERROR: $srcdir/../lib/framework.exp doesn't exist"
31 # test group handling
33 run_tests {
34     { lib_errpat_test testcase { group bogus-command }
35         "*unknown*bogus-command*"
36         "reject bogus group operation" }
37     { lib_errpat_test testcase { group begin "no spaces in group names" }
38         "*spaces in group names*is not valid*"
39         "reject entering group with spaces in name" }
41     { lib_ret_test testcase { group } ""
42         "initially in no group" }
43     { lib_ret_test testcase { group begin foo } "foo"
44         "enter group 'foo'" }
45     { lib_ret_test testcase { group } "foo"
46         "now in group 'foo'" }
47     { lib_ret_test testcase { group begin bar } "bar"
48         "enter group 'bar' (foo/bar)" }
49     { lib_ret_test testcase { group } "foo/bar"
50         "now in group 'foo/bar'" }
51     { lib_errpat_test testcase { group end foo }
52         "*expected to close group*foo*found group*bar*"
53         "error on mismatch leaving 'foo' in 'foo/bar'" }
54     { lib_errpat_test testcase { group end "foo/bar" }
55         "*expected to close group*foo/bar*found group*bar*"
56         "error on mismatch leaving 'foo/bar'" }
57     { lib_ret_test testcase { group end bar } "bar"
58         "leave group 'bar' (foo)" }
59     { lib_ret_test testcase { group } "foo"
60         "back in group 'foo'" }
61     { lib_ret_test testcase { group begin "baz/bar" } "baz/bar"
62         "enter group 'baz/bar' (foo/baz/bar)" }
63     { lib_ret_test testcase { group } "foo/baz/bar"
64         "now in group 'foo/baz/bar'" }
65     { lib_ret_test testcase { group eval "quux" {testcase group} }
66         "foo/baz/bar/quux"
67         "group 'foo/baz/bar/quux' entered for eval" }
68     { lib_ret_test testcase { group } "foo/baz/bar"
69         "still in group 'foo/baz/bar' after eval" }
70     { lib_ret_test testcase { group end "baz/bar" } "baz/bar"
71         "leave group 'baz/bar' (foo)" }
72     { lib_ret_test testcase { group end foo } "foo"
73         "leave group 'foo'" }
74     { lib_ret_test testcase { group } ""
75         "finally in no group" }
78 puts "END testcase_group.test"