Debian Codegraph @

tests/test-hghave.t

raw ◀ ▶
1 Debian patch touch this file
1 $ . "$TESTDIR/helper-runtests.sh"
2
3 Testing that hghave does not crash when checking features
4
5 $ hghave --test-features 2>/dev/null
6
7 Testing hghave extensibility for third party tools
8
9 $ cat > hghaveaddon.py <<EOF
10 > import hghave
11 > @hghave.check("custom", "custom hghave feature")
12 > def has_custom():
13 > return True
14 > EOF
15
16 (invocation via run-tests.py)
17
18 $ cat > test-hghaveaddon.t <<EOF
19 > #require custom
20 > $ echo foo
21 > foo
22 > EOF
23
24 #if windows
25 $ MAYBE_PURE=""
26 #else
27 We use --pure install to avoid doing a full build and install of Mercurial in
28 the middle of the test (and the associated dependencies). We need to not do
29 that on windows as mixing --pure with non-pure run confuse runtests.py as
30 `hg.bat` is expected instead of `hg.exe`. Since this is not the core of what is
31 tested here, we work around the issue for now.
32 $ MAYBE_PURE="--pure"
33 #endif
34
35
36 $ ( \
37 > "$PYTHON" $TESTDIR/run-tests.py \
38 > --with-hg=$HGTEST_REAL_HG $MAYBE_PURE\
39 > --jobs 1 \
40 > test-hghaveaddon.t \
41 > )
42 installed Mercurial in * seconds (glob) (?)
43 running 1 tests using 1 parallel processes
44 .
45 # Ran 1 tests, 0 skipped, 0 failed.
46
47 (invocation via command line)
48
49 $ unset TESTDIR
50 $ hghave custom
51
52 (terminate with exit code 2 at failure of importing hghaveaddon.py)
53
54 $ rm hghaveaddon.*
55 $ cat > hghaveaddon.py <<NO_CHECK_EOF
56 > importing this file should cause syntax error
57 > NO_CHECK_EOF
58
59 $ hghave custom
60 failed to import hghaveaddon.py from '.': invalid syntax (hghaveaddon.py, line 1)
61 [2]