Mercurial > hg
annotate tests/test-contrib-testparseutil.t @ 40093:726cfc47f17a
contrib: add an utility module to parse test scripts
This patch centralizes the logic to pick up code fragments embedded in
*.t script, in order to:
- apply checking with patterns in check-code.py on such embedded
code fragments
Now, check-code.py completely ignores embedded code
fragments. I'll post another patch series to check them.
- replace similar code path in contrib/import-checker.py
Current import-checker.py has problems below. Fixing each of them
is a little difficult, because parsing logic and pattern strings
are tightly coupled.
- overlook (or mis-detect) the end of inline script in doctest
style
8a8dd6e4a97a fixed a part of this issue, but not enough.
- it overlooks inline script in doctest style at the end of file
(and ignores invalid un-closed heredoc at the end of file, too)
- it overlooks code fragment in styles below
- "python <<EOF" (heredoc should be "cat > file <<EOF" style)
- "cat > foobar.py << ANYLIMIT" (limit mark should be "EOF")
- "cat << EOF > foobar.py" (filename should be placed before limit mark)
- "cat >> foobar.py << EOF" (appending is ignored)
- it is not extensible for other than python code fragments
(e.g. shell script, hgrc file, and so on)
This new module can detect python code fragments in styles below:
- inline script in doctest style (starting by " >>> " line)
- python invocation with heredoc script ("python <<EOF")
- python script in heredoc style (redirected into ".py" file)
As an example of extensibility of new module, this patch also contains
implementation to pick up code fragment below. This will be useful to
add additional restriction for them, for example.
- shell script in heredoc style (redirected into ".sh" file)
- hgrc configuration in heredoc style (redirected into hgrc or $HGRCPATH)
author | FUJIWARA Katsunori <foozy@lares.dti.ne.jp> |
---|---|
date | Thu, 23 Aug 2018 12:25:54 +0900 |
parents | |
children |
rev | line source |
---|---|
40093
726cfc47f17a
contrib: add an utility module to parse test scripts
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff
changeset
|
1 $ testparseutil="$TESTDIR"/../contrib/testparseutil.py |
726cfc47f17a
contrib: add an utility module to parse test scripts
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff
changeset
|
2 |
726cfc47f17a
contrib: add an utility module to parse test scripts
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff
changeset
|
3 Internal test by doctest |
726cfc47f17a
contrib: add an utility module to parse test scripts
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff
changeset
|
4 |
726cfc47f17a
contrib: add an utility module to parse test scripts
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff
changeset
|
5 $ "$PYTHON" -m doctest "$testparseutil" |
726cfc47f17a
contrib: add an utility module to parse test scripts
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff
changeset
|
6 |
726cfc47f17a
contrib: add an utility module to parse test scripts
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff
changeset
|
7 Tests for embedded python script |
726cfc47f17a
contrib: add an utility module to parse test scripts
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff
changeset
|
8 |
726cfc47f17a
contrib: add an utility module to parse test scripts
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff
changeset
|
9 Typical cases |
726cfc47f17a
contrib: add an utility module to parse test scripts
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff
changeset
|
10 |
726cfc47f17a
contrib: add an utility module to parse test scripts
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff
changeset
|
11 $ "$PYTHON" "$testparseutil" -v pyembedded <<NO_CHECK_EOF |
726cfc47f17a
contrib: add an utility module to parse test scripts
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff
changeset
|
12 > >>> for f in [1, 2, 3]: |
726cfc47f17a
contrib: add an utility module to parse test scripts
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff
changeset
|
13 > ... foo = 1 |
726cfc47f17a
contrib: add an utility module to parse test scripts
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff
changeset
|
14 > >>> foo = 2 |
726cfc47f17a
contrib: add an utility module to parse test scripts
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff
changeset
|
15 > $ echo "doctest is terminated by command, empty line, or comment" |
726cfc47f17a
contrib: add an utility module to parse test scripts
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff
changeset
|
16 > >>> foo = 31 |
726cfc47f17a
contrib: add an utility module to parse test scripts
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff
changeset
|
17 > expected output of doctest fragment |
726cfc47f17a
contrib: add an utility module to parse test scripts
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff
changeset
|
18 > >>> foo = 32 |
726cfc47f17a
contrib: add an utility module to parse test scripts
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff
changeset
|
19 > |
726cfc47f17a
contrib: add an utility module to parse test scripts
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff
changeset
|
20 > >>> foo = 33 |
726cfc47f17a
contrib: add an utility module to parse test scripts
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff
changeset
|
21 > |
726cfc47f17a
contrib: add an utility module to parse test scripts
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff
changeset
|
22 > >>> foo = 34 |
726cfc47f17a
contrib: add an utility module to parse test scripts
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff
changeset
|
23 > comment |
726cfc47f17a
contrib: add an utility module to parse test scripts
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff
changeset
|
24 > >>> foo = 35 |
726cfc47f17a
contrib: add an utility module to parse test scripts
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff
changeset
|
25 > |
726cfc47f17a
contrib: add an utility module to parse test scripts
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff
changeset
|
26 > $ "\$PYTHON" <<EOF |
726cfc47f17a
contrib: add an utility module to parse test scripts
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff
changeset
|
27 > > foo = 4 |
726cfc47f17a
contrib: add an utility module to parse test scripts
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff
changeset
|
28 > > |
726cfc47f17a
contrib: add an utility module to parse test scripts
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff
changeset
|
29 > > EOF |
726cfc47f17a
contrib: add an utility module to parse test scripts
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff
changeset
|
30 > $ cat > foo.py <<EOF |
726cfc47f17a
contrib: add an utility module to parse test scripts
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff
changeset
|
31 > > foo = 5 |
726cfc47f17a
contrib: add an utility module to parse test scripts
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff
changeset
|
32 > > EOF |
726cfc47f17a
contrib: add an utility module to parse test scripts
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff
changeset
|
33 > $ cat >> foo.py <<EOF |
726cfc47f17a
contrib: add an utility module to parse test scripts
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff
changeset
|
34 > > foo = 6 # appended |
726cfc47f17a
contrib: add an utility module to parse test scripts
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff
changeset
|
35 > > EOF |
726cfc47f17a
contrib: add an utility module to parse test scripts
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff
changeset
|
36 > |
726cfc47f17a
contrib: add an utility module to parse test scripts
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff
changeset
|
37 > NO_CHECK_EOF limit mark makes parsing ignore corresponded fragment |
726cfc47f17a
contrib: add an utility module to parse test scripts
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff
changeset
|
38 > (this is useful to use bad code intentionally) |
726cfc47f17a
contrib: add an utility module to parse test scripts
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff
changeset
|
39 > |
726cfc47f17a
contrib: add an utility module to parse test scripts
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff
changeset
|
40 > $ "\$PYTHON" <<NO_CHECK_EOF |
726cfc47f17a
contrib: add an utility module to parse test scripts
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff
changeset
|
41 > > foo = 7 # this should be ignored at detection |
726cfc47f17a
contrib: add an utility module to parse test scripts
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff
changeset
|
42 > > NO_CHECK_EOF |
726cfc47f17a
contrib: add an utility module to parse test scripts
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff
changeset
|
43 > $ cat > foo.py <<NO_CHECK_EOF |
726cfc47f17a
contrib: add an utility module to parse test scripts
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff
changeset
|
44 > > foo = 8 # this should be ignored at detection |
726cfc47f17a
contrib: add an utility module to parse test scripts
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff
changeset
|
45 > > NO_CHECK_EOF |
726cfc47f17a
contrib: add an utility module to parse test scripts
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff
changeset
|
46 > |
726cfc47f17a
contrib: add an utility module to parse test scripts
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff
changeset
|
47 > doctest fragment ended by EOF |
726cfc47f17a
contrib: add an utility module to parse test scripts
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff
changeset
|
48 > |
726cfc47f17a
contrib: add an utility module to parse test scripts
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff
changeset
|
49 > >>> foo = 9 |
726cfc47f17a
contrib: add an utility module to parse test scripts
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff
changeset
|
50 > NO_CHECK_EOF |
726cfc47f17a
contrib: add an utility module to parse test scripts
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff
changeset
|
51 <stdin>:1: <anonymous> starts |
726cfc47f17a
contrib: add an utility module to parse test scripts
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff
changeset
|
52 |for f in [1, 2, 3]: |
726cfc47f17a
contrib: add an utility module to parse test scripts
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff
changeset
|
53 | foo = 1 |
726cfc47f17a
contrib: add an utility module to parse test scripts
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff
changeset
|
54 |foo = 2 |
726cfc47f17a
contrib: add an utility module to parse test scripts
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff
changeset
|
55 <stdin>:4: <anonymous> ends |
726cfc47f17a
contrib: add an utility module to parse test scripts
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff
changeset
|
56 <stdin>:5: <anonymous> starts |
726cfc47f17a
contrib: add an utility module to parse test scripts
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff
changeset
|
57 |foo = 31 |
726cfc47f17a
contrib: add an utility module to parse test scripts
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff
changeset
|
58 | |
726cfc47f17a
contrib: add an utility module to parse test scripts
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff
changeset
|
59 |foo = 32 |
726cfc47f17a
contrib: add an utility module to parse test scripts
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff
changeset
|
60 | |
726cfc47f17a
contrib: add an utility module to parse test scripts
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff
changeset
|
61 |foo = 33 |
726cfc47f17a
contrib: add an utility module to parse test scripts
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff
changeset
|
62 <stdin>:10: <anonymous> ends |
726cfc47f17a
contrib: add an utility module to parse test scripts
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff
changeset
|
63 <stdin>:11: <anonymous> starts |
726cfc47f17a
contrib: add an utility module to parse test scripts
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff
changeset
|
64 |foo = 34 |
726cfc47f17a
contrib: add an utility module to parse test scripts
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff
changeset
|
65 <stdin>:12: <anonymous> ends |
726cfc47f17a
contrib: add an utility module to parse test scripts
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff
changeset
|
66 <stdin>:13: <anonymous> starts |
726cfc47f17a
contrib: add an utility module to parse test scripts
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff
changeset
|
67 |foo = 35 |
726cfc47f17a
contrib: add an utility module to parse test scripts
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff
changeset
|
68 <stdin>:14: <anonymous> ends |
726cfc47f17a
contrib: add an utility module to parse test scripts
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff
changeset
|
69 <stdin>:16: <anonymous> starts |
726cfc47f17a
contrib: add an utility module to parse test scripts
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff
changeset
|
70 |foo = 4 |
726cfc47f17a
contrib: add an utility module to parse test scripts
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff
changeset
|
71 | |
726cfc47f17a
contrib: add an utility module to parse test scripts
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff
changeset
|
72 <stdin>:18: <anonymous> ends |
726cfc47f17a
contrib: add an utility module to parse test scripts
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff
changeset
|
73 <stdin>:20: foo.py starts |
726cfc47f17a
contrib: add an utility module to parse test scripts
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff
changeset
|
74 |foo = 5 |
726cfc47f17a
contrib: add an utility module to parse test scripts
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff
changeset
|
75 <stdin>:21: foo.py ends |
726cfc47f17a
contrib: add an utility module to parse test scripts
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff
changeset
|
76 <stdin>:23: foo.py starts |
726cfc47f17a
contrib: add an utility module to parse test scripts
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff
changeset
|
77 |foo = 6 # appended |
726cfc47f17a
contrib: add an utility module to parse test scripts
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff
changeset
|
78 <stdin>:24: foo.py ends |
726cfc47f17a
contrib: add an utility module to parse test scripts
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff
changeset
|
79 <stdin>:38: <anonymous> starts |
726cfc47f17a
contrib: add an utility module to parse test scripts
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff
changeset
|
80 |foo = 9 |
726cfc47f17a
contrib: add an utility module to parse test scripts
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff
changeset
|
81 <stdin>:39: <anonymous> ends |
726cfc47f17a
contrib: add an utility module to parse test scripts
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff
changeset
|
82 |
726cfc47f17a
contrib: add an utility module to parse test scripts
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff
changeset
|
83 Invalid test script |
726cfc47f17a
contrib: add an utility module to parse test scripts
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff
changeset
|
84 |
726cfc47f17a
contrib: add an utility module to parse test scripts
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff
changeset
|
85 (similar test for shell script and hgrc configuration is omitted, |
726cfc47f17a
contrib: add an utility module to parse test scripts
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff
changeset
|
86 because this tests common base class of them) |
726cfc47f17a
contrib: add an utility module to parse test scripts
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff
changeset
|
87 |
726cfc47f17a
contrib: add an utility module to parse test scripts
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff
changeset
|
88 $ "$PYTHON" "$testparseutil" -v pyembedded <<NO_CHECK_EOF > detected |
726cfc47f17a
contrib: add an utility module to parse test scripts
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff
changeset
|
89 > $ "\$PYTHON" <<EOF |
726cfc47f17a
contrib: add an utility module to parse test scripts
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff
changeset
|
90 > > foo = 1 |
726cfc47f17a
contrib: add an utility module to parse test scripts
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff
changeset
|
91 > |
726cfc47f17a
contrib: add an utility module to parse test scripts
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff
changeset
|
92 > $ "\$PYTHON" <<EOF |
726cfc47f17a
contrib: add an utility module to parse test scripts
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff
changeset
|
93 > > foo = 2 |
726cfc47f17a
contrib: add an utility module to parse test scripts
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff
changeset
|
94 > $ cat > bar.py <<EOF |
726cfc47f17a
contrib: add an utility module to parse test scripts
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff
changeset
|
95 > > bar = 2 # this fragment will be detected as expected |
726cfc47f17a
contrib: add an utility module to parse test scripts
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff
changeset
|
96 > > EOF |
726cfc47f17a
contrib: add an utility module to parse test scripts
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff
changeset
|
97 > |
726cfc47f17a
contrib: add an utility module to parse test scripts
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff
changeset
|
98 > $ cat > foo.py <<EOF |
726cfc47f17a
contrib: add an utility module to parse test scripts
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff
changeset
|
99 > > foo = 3 |
726cfc47f17a
contrib: add an utility module to parse test scripts
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff
changeset
|
100 > NO_CHECK_EOF |
726cfc47f17a
contrib: add an utility module to parse test scripts
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff
changeset
|
101 <stdin>:3: unexpected line for "heredoc python invocation" |
726cfc47f17a
contrib: add an utility module to parse test scripts
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff
changeset
|
102 <stdin>:6: unexpected line for "heredoc python invocation" |
726cfc47f17a
contrib: add an utility module to parse test scripts
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff
changeset
|
103 <stdin>:11: unexpected end of file for "heredoc .py file" |
726cfc47f17a
contrib: add an utility module to parse test scripts
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff
changeset
|
104 [1] |
726cfc47f17a
contrib: add an utility module to parse test scripts
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff
changeset
|
105 $ cat detected |
726cfc47f17a
contrib: add an utility module to parse test scripts
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff
changeset
|
106 <stdin>:7: bar.py starts |
726cfc47f17a
contrib: add an utility module to parse test scripts
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff
changeset
|
107 |bar = 2 # this fragment will be detected as expected |
726cfc47f17a
contrib: add an utility module to parse test scripts
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff
changeset
|
108 <stdin>:8: bar.py ends |
726cfc47f17a
contrib: add an utility module to parse test scripts
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff
changeset
|
109 |
726cfc47f17a
contrib: add an utility module to parse test scripts
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff
changeset
|
110 Tests for embedded shell script |
726cfc47f17a
contrib: add an utility module to parse test scripts
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff
changeset
|
111 |
726cfc47f17a
contrib: add an utility module to parse test scripts
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff
changeset
|
112 $ "$PYTHON" "$testparseutil" -v shembedded <<NO_CHECK_EOF |
726cfc47f17a
contrib: add an utility module to parse test scripts
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff
changeset
|
113 > $ cat > foo.sh <<EOF |
726cfc47f17a
contrib: add an utility module to parse test scripts
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff
changeset
|
114 > > foo = 1 |
726cfc47f17a
contrib: add an utility module to parse test scripts
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff
changeset
|
115 > > |
726cfc47f17a
contrib: add an utility module to parse test scripts
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff
changeset
|
116 > > foo = 2 |
726cfc47f17a
contrib: add an utility module to parse test scripts
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff
changeset
|
117 > > EOF |
726cfc47f17a
contrib: add an utility module to parse test scripts
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff
changeset
|
118 > $ cat >> foo.sh <<EOF |
726cfc47f17a
contrib: add an utility module to parse test scripts
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff
changeset
|
119 > > foo = 3 # appended |
726cfc47f17a
contrib: add an utility module to parse test scripts
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff
changeset
|
120 > > EOF |
726cfc47f17a
contrib: add an utility module to parse test scripts
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff
changeset
|
121 > |
726cfc47f17a
contrib: add an utility module to parse test scripts
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff
changeset
|
122 > NO_CHECK_EOF limit mark makes parsing ignore corresponded fragment |
726cfc47f17a
contrib: add an utility module to parse test scripts
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff
changeset
|
123 > (this is useful to use bad code intentionally) |
726cfc47f17a
contrib: add an utility module to parse test scripts
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff
changeset
|
124 > |
726cfc47f17a
contrib: add an utility module to parse test scripts
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff
changeset
|
125 > $ cat > foo.sh <<NO_CHECK_EOF |
726cfc47f17a
contrib: add an utility module to parse test scripts
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff
changeset
|
126 > > # this should be ignored at detection |
726cfc47f17a
contrib: add an utility module to parse test scripts
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff
changeset
|
127 > > foo = 4 |
726cfc47f17a
contrib: add an utility module to parse test scripts
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff
changeset
|
128 > > NO_CHECK_EOF |
726cfc47f17a
contrib: add an utility module to parse test scripts
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff
changeset
|
129 > |
726cfc47f17a
contrib: add an utility module to parse test scripts
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff
changeset
|
130 > NO_CHECK_EOF |
726cfc47f17a
contrib: add an utility module to parse test scripts
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff
changeset
|
131 <stdin>:2: foo.sh starts |
726cfc47f17a
contrib: add an utility module to parse test scripts
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff
changeset
|
132 |foo = 1 |
726cfc47f17a
contrib: add an utility module to parse test scripts
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff
changeset
|
133 | |
726cfc47f17a
contrib: add an utility module to parse test scripts
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff
changeset
|
134 |foo = 2 |
726cfc47f17a
contrib: add an utility module to parse test scripts
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff
changeset
|
135 <stdin>:5: foo.sh ends |
726cfc47f17a
contrib: add an utility module to parse test scripts
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff
changeset
|
136 <stdin>:7: foo.sh starts |
726cfc47f17a
contrib: add an utility module to parse test scripts
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff
changeset
|
137 |foo = 3 # appended |
726cfc47f17a
contrib: add an utility module to parse test scripts
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff
changeset
|
138 <stdin>:8: foo.sh ends |
726cfc47f17a
contrib: add an utility module to parse test scripts
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff
changeset
|
139 |
726cfc47f17a
contrib: add an utility module to parse test scripts
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff
changeset
|
140 Tests for embedded hgrc configuration |
726cfc47f17a
contrib: add an utility module to parse test scripts
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff
changeset
|
141 |
726cfc47f17a
contrib: add an utility module to parse test scripts
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff
changeset
|
142 $ "$PYTHON" "$testparseutil" -v hgrcembedded <<NO_CHECK_EOF |
726cfc47f17a
contrib: add an utility module to parse test scripts
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff
changeset
|
143 > $ cat > .hg/hgrc <<EOF |
726cfc47f17a
contrib: add an utility module to parse test scripts
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff
changeset
|
144 > > [ui] |
726cfc47f17a
contrib: add an utility module to parse test scripts
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff
changeset
|
145 > > verbose = true |
726cfc47f17a
contrib: add an utility module to parse test scripts
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff
changeset
|
146 > > |
726cfc47f17a
contrib: add an utility module to parse test scripts
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff
changeset
|
147 > > # end of local configuration |
726cfc47f17a
contrib: add an utility module to parse test scripts
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff
changeset
|
148 > > EOF |
726cfc47f17a
contrib: add an utility module to parse test scripts
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff
changeset
|
149 > |
726cfc47f17a
contrib: add an utility module to parse test scripts
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff
changeset
|
150 > $ cat > \$HGRCPATH <<EOF |
726cfc47f17a
contrib: add an utility module to parse test scripts
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff
changeset
|
151 > > [extensions] |
726cfc47f17a
contrib: add an utility module to parse test scripts
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff
changeset
|
152 > > rebase = |
726cfc47f17a
contrib: add an utility module to parse test scripts
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff
changeset
|
153 > > # end of global configuration |
726cfc47f17a
contrib: add an utility module to parse test scripts
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff
changeset
|
154 > > EOF |
726cfc47f17a
contrib: add an utility module to parse test scripts
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff
changeset
|
155 > |
726cfc47f17a
contrib: add an utility module to parse test scripts
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff
changeset
|
156 > $ cat >> \$HGRCPATH <<EOF |
726cfc47f17a
contrib: add an utility module to parse test scripts
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff
changeset
|
157 > > # appended |
726cfc47f17a
contrib: add an utility module to parse test scripts
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff
changeset
|
158 > > [extensions] |
726cfc47f17a
contrib: add an utility module to parse test scripts
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff
changeset
|
159 > > rebase =! |
726cfc47f17a
contrib: add an utility module to parse test scripts
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff
changeset
|
160 > > EOF |
726cfc47f17a
contrib: add an utility module to parse test scripts
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff
changeset
|
161 > |
726cfc47f17a
contrib: add an utility module to parse test scripts
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff
changeset
|
162 > NO_CHECK_EOF limit mark makes parsing ignore corresponded fragment |
726cfc47f17a
contrib: add an utility module to parse test scripts
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff
changeset
|
163 > (this is useful to use bad code intentionally) |
726cfc47f17a
contrib: add an utility module to parse test scripts
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff
changeset
|
164 > |
726cfc47f17a
contrib: add an utility module to parse test scripts
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff
changeset
|
165 > $ cat > .hg/hgrc <<NO_CHECK_EOF |
726cfc47f17a
contrib: add an utility module to parse test scripts
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff
changeset
|
166 > > # this local configuration should be ignored at detection |
726cfc47f17a
contrib: add an utility module to parse test scripts
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff
changeset
|
167 > > [ui] |
726cfc47f17a
contrib: add an utility module to parse test scripts
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff
changeset
|
168 > > username = foo bar |
726cfc47f17a
contrib: add an utility module to parse test scripts
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff
changeset
|
169 > > NO_CHECK_EOF |
726cfc47f17a
contrib: add an utility module to parse test scripts
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff
changeset
|
170 > |
726cfc47f17a
contrib: add an utility module to parse test scripts
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff
changeset
|
171 > $ cat > \$HGRCPATH <<NO_CHECK_EOF |
726cfc47f17a
contrib: add an utility module to parse test scripts
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff
changeset
|
172 > > # this global configuration should be ignored at detection |
726cfc47f17a
contrib: add an utility module to parse test scripts
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff
changeset
|
173 > > [extensions] |
726cfc47f17a
contrib: add an utility module to parse test scripts
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff
changeset
|
174 > > foobar = |
726cfc47f17a
contrib: add an utility module to parse test scripts
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff
changeset
|
175 > > NO_CHECK_EOF |
726cfc47f17a
contrib: add an utility module to parse test scripts
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff
changeset
|
176 > NO_CHECK_EOF |
726cfc47f17a
contrib: add an utility module to parse test scripts
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff
changeset
|
177 <stdin>:2: .hg/hgrc starts |
726cfc47f17a
contrib: add an utility module to parse test scripts
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff
changeset
|
178 |[ui] |
726cfc47f17a
contrib: add an utility module to parse test scripts
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff
changeset
|
179 |verbose = true |
726cfc47f17a
contrib: add an utility module to parse test scripts
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff
changeset
|
180 | |
726cfc47f17a
contrib: add an utility module to parse test scripts
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff
changeset
|
181 |# end of local configuration |
726cfc47f17a
contrib: add an utility module to parse test scripts
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff
changeset
|
182 <stdin>:6: .hg/hgrc ends |
726cfc47f17a
contrib: add an utility module to parse test scripts
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff
changeset
|
183 <stdin>:9: $HGRCPATH starts |
726cfc47f17a
contrib: add an utility module to parse test scripts
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff
changeset
|
184 |[extensions] |
726cfc47f17a
contrib: add an utility module to parse test scripts
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff
changeset
|
185 |rebase = |
726cfc47f17a
contrib: add an utility module to parse test scripts
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff
changeset
|
186 |# end of global configuration |
726cfc47f17a
contrib: add an utility module to parse test scripts
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff
changeset
|
187 <stdin>:12: $HGRCPATH ends |
726cfc47f17a
contrib: add an utility module to parse test scripts
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff
changeset
|
188 <stdin>:15: $HGRCPATH starts |
726cfc47f17a
contrib: add an utility module to parse test scripts
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff
changeset
|
189 |# appended |
726cfc47f17a
contrib: add an utility module to parse test scripts
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff
changeset
|
190 |[extensions] |
726cfc47f17a
contrib: add an utility module to parse test scripts
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff
changeset
|
191 |rebase =! |
726cfc47f17a
contrib: add an utility module to parse test scripts
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff
changeset
|
192 <stdin>:18: $HGRCPATH ends |