Fix miscounting of expected failures in C unit test API
[dejagnu.git] / testsuite / runtest.libs / testcase_group.test
blob3b4a0ec6ce243f4eb0b2dd5857e37c815bc19047
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, write to the Free Software Foundation,
19 # Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
21 if [ file exists $srcdir/$subdir/default_procs.tcl ] {
22     source "$srcdir/$subdir/default_procs.tcl"
23 } else {
24     puts "ERROR: $srcdir/$subdir/default_procs.tcl doesn't exist"
26 if [ file exists $srcdir/../lib/framework.exp] {
27     source $srcdir/../lib/framework.exp
28 } else {
29     puts "ERROR: $srcdir/../lib/framework.exp doesn't exist"
32 # test group handling
34 run_tests {
35     { lib_errpat_test testcase { group bogus-command }
36         "*unknown*bogus-command*"
37         "reject bogus group operation" }
38     { lib_errpat_test testcase { group begin "no spaces in group names" }
39         "*spaces in group names*is not valid*"
40         "reject entering group with spaces in name" }
42     { lib_ret_test testcase { group } ""
43         "initially in no group" }
44     { lib_ret_test testcase { group begin foo } "foo"
45         "enter group 'foo'" }
46     { lib_ret_test testcase { group } "foo"
47         "now in group 'foo'" }
48     { lib_ret_test testcase { group begin bar } "bar"
49         "enter group 'bar' (foo/bar)" }
50     { lib_ret_test testcase { group } "foo/bar"
51         "now in group 'foo/bar'" }
52     { lib_errpat_test testcase { group end foo }
53         "*expected to close group*foo*found group*bar*"
54         "error on mismatch leaving 'foo' in 'foo/bar'" }
55     { lib_errpat_test testcase { group end "foo/bar" }
56         "*expected to close group*foo/bar*found group*bar*"
57         "error on mismatch leaving 'foo/bar'" }
58     { lib_ret_test testcase { group end bar } "bar"
59         "leave group 'bar' (foo)" }
60     { lib_ret_test testcase { group } "foo"
61         "back in group 'foo'" }
62     { lib_ret_test testcase { group begin "baz/bar" } "baz/bar"
63         "enter group 'baz/bar' (foo/baz/bar)" }
64     { lib_ret_test testcase { group } "foo/baz/bar"
65         "now in group 'foo/baz/bar'" }
66     { lib_ret_test testcase { group eval "quux" {testcase group} }
67         "foo/baz/bar/quux"
68         "group 'foo/baz/bar/quux' entered for eval" }
69     { lib_ret_test testcase { group } "foo/baz/bar"
70         "still in group 'foo/baz/bar' after eval" }
71     { lib_ret_test testcase { group end "baz/bar" } "baz/bar"
72         "leave group 'baz/bar' (foo)" }
73     { lib_ret_test testcase { group end foo } "foo"
74         "leave group 'foo'" }
75     { lib_ret_test testcase { group } ""
76         "finally in no group" }
79 puts "END testcase_group.test"