File: debug.t

package info (click to toggle)
cram 0.7-6
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 336 kB
  • sloc: python: 908; makefile: 46; sh: 20
file content (67 lines) | stat: -rw-r--r-- 1,406 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
Set up cram alias and example tests:

  $ . "$TESTDIR"/setup.sh

Debug mode:

  $ printf '  $ echo hi\n  > echo bye' > debug.t
  $ cram -d -v debug.t
  options --debug and --verbose are mutually exclusive
  [2]
  $ cram -d -q debug.t
  options --debug and --quiet are mutually exclusive
  [2]
  $ cram -d -i debug.t
  options --debug and --interactive are mutually exclusive
  [2]
  $ cram -d --xunit-file==cram.xml debug.t
  options --debug and --xunit-file are mutually exclusive
  [2]
  $ cram -d debug.t
  hi
  bye
  $ cram -d examples/empty.t

Debug mode with extra shell arguments:

  $ cram --shell-opts='-s' -d debug.t
  hi
  bye

Test debug mode with set -x:

  $ cat > set-x.t <<EOF
  >   $ echo 1
  >   1
  >   $ set -x
  >   $ echo 2
  > EOF
  $ cram -d set-x.t
  1
  \+.*echo 2 (re)
  2

Test set -x without debug mode:

  $ cram set-x.t
  !
  --- set-x.t
  +++ set-x.t.err
  @@ -1,4 +1,8 @@
     $ echo 1
     1
     $ set -x
  \+  \+.*echo  \(no-eol\) (re)
     $ echo 2
  \+  \+.*echo 2 (re)
  +  2
  \+  \+.*echo  \(no-eol\) (re)
  
  # Ran 1 tests, 0 skipped, 1 failed.
  [1]

Note that the "+ echo  (no-eol)" lines are artifacts of the echo commands
that Cram inserts into the test in order to track output. It'd be nice if
Cram could avoid removing salt/line number/return code information from those
lines, but it isn't possible to distinguish between set -x output and normal
output.