tests: rename 'tests/' => 't/', '*.test' => '*.sh'
[platform/upstream/automake.git] / t / rst-formatting.sh
1 #! /bin/sh
2 # Copyright (C) 2012 Free Software Foundation, Inc.
3 #
4 # This program is free software; you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License as published by
6 # the Free Software Foundation; either version 2, or (at your option)
7 # any later version.
8 #
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12 # GNU General Public License for more details.
13 #
14 # You should have received a copy of the GNU General Public License
15 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
16
17 # Parallel testsuite harness: check APIs for the registering the
18 # "global test result" in '*.trs' files, as documented in the automake
19 # manual.
20
21 am_create_testdir=empty
22 . ./defs || Exit 1
23
24 sed -n '/^am__rst_[a-z_][a-z_]* =/p' "$am_amdir"/check.am > Makefile \
25   || framework_failure_ "fetching definitions from check.am"
26
27 cat >> Makefile << 'END'
28 test:
29         printf '%s\n' "$$in" | $(am__rst_title) > title-got
30         printf '%s\n' "$$in" | $(am__rst_section) > section-got
31         cat title-exp
32         cat title-got
33         diff title-exp title-got
34         cat section-exp
35         cat section-got
36         diff section-exp section-got
37 END
38
39 # -------------------------------------------------------------------------
40
41 cat > title-exp <<'END'
42 ==============
43    ab cd ef
44 ==============
45
46 END
47
48 cat > section-exp <<'END'
49 ab cd ef
50 ========
51
52 END
53
54 env in='ab cd ef' $MAKE test
55
56 # -------------------------------------------------------------------------
57
58 cat > title-exp <<'END'
59 ============================================================================
60    0123456789012345678901234567890123456789012345678901234567890123456789
61 ============================================================================
62
63 END
64
65 cat > section-exp <<'END'
66 0123456789012345678901234567890123456789012345678901234567890123456789
67 ======================================================================
68
69 END
70
71 in=0123456789012345678901234567890123456789012345678901234567890123456789
72 env in=$in $MAKE test
73
74 # -------------------------------------------------------------------------
75
76 cat > title-exp <<'END'
77 =======
78    x
79 =======
80
81 END
82
83 cat > section-exp <<'END'
84 x
85 =
86
87 END
88
89 env in=x $MAKE test
90
91 # -------------------------------------------------------------------------
92
93 :