File: test.cram

package info (click to toggle)
git-big-picture 1.3.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 3,284 kB
  • sloc: python: 1,130; sh: 89; makefile: 17
file content (153 lines) | stat: -rwxr-xr-x 4,986 bytes parent folder | download | duplicates (3)
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
#!/usr/bin/env cram
# This file is part of git-big-picture
#
# Copyright (C) 2012-2018 Valentin Haenel <valentin.haenel@gmx.de>
# Copyright (C) 2020      Sebastian Pipping <sebastian@pipping.org>
#
# git-big-picture is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# git-big-picture is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with git-big-picture.  If not, see <http://www.gnu.org/licenses/>.

# Cram (https://bitheap.org/cram/) tests for git-big-picture

no repo
    $ git-big-picture
    fatal: '/.+' is probably not a Git repository (re)
    [10]

create a fake repo (i.e. global setup for all following tests)
    $ git init -q
    $ git config user.email tests@git-big-picture.test
    $ git config user.name 'git-big-picture test suite'
    $ git commit -q --allow-empty -m "foo"
    $ git config big-picture.wait 0.01  # to speed up the test suite

run without options (entry point generated by setuptools)
    $ git-big-picture .
    fatal: Must provide an output option. Try '-h' for more information
    [8]

run without options (__main__ module)
    $ python3 -m git_big_picture .
    fatal: Must provide an output option. Try '-h' for more information
    [8]

cover including commit messages (smoke test)
    $ git-big-picture -c -g >/dev/null

test option precedence for -C followed by -c (include commit messages)
    $ git-big-picture -g -C -c | grep -q 'foo'

test option precedence for -c followed by -C (don't include commit messages)
    $ git-big-picture -g -c -C | grep -q 'foo'
    [1]

mix --graphviz and --processed and others
    $ git-big-picture -p -g
    fatal: Options '-g | --graphviz' and '-p | --processed' are mutually exclusive.
    [7]
    $ git-big-picture -g -v true
    fatal: Options '-g | --graphviz' and '-p | --processed' are incompatible with other output options.
    [7]
    $ git-big-picture -p -v true
    fatal: Options '-g | --graphviz' and '-p | --processed' are incompatible with other output options.
    [7]
    $ git-big-picture -g -o file.svg
    fatal: Options '-g | --graphviz' and '-p | --processed' are incompatible with other output options.
    [7]
    $ git-big-picture -p -o file.svg
    fatal: Options '-g | --graphviz' and '-p | --processed' are incompatible with other output options.
    [7]

try wrong format
    $ git-big-picture -p -f foo
    fatal: 'dot' terminated prematurely with error code 1;
    probably you specified an invalid format, see 'man dot'.
    The error from 'dot' was:
    >>>Format: "foo" not recognized. Use one of: .*$ (re)
    
    [4]

mismatch format, filename takes precedence
    $ git-big-picture -f pdf -o file.svg
    $ ls
    file.svg
    $ rm file.svg

try just filename
    $ git-big-picture -o file.svg
    $ ls
    file.svg
    $ rm file.svg

try using different format
    $ git-big-picture -o file.pdf
    $ ls
    file.pdf
    $ rm file.pdf

try no such viewer
    $ git-big-picture -f svg -v foo
    fatal: Error calling viewer: 'foo':
    >>>\[Errno 2\] No such file or directory.*$ (re)
    [6]

format but no extension
    $ git-big-picture -f svg -o file
    warning: Filename had no suffix, using format: svg
    $ ls
    file.svg
    $ rm file.svg

provide filename and viewer
    $ git-big-picture -o file.svg -v true
    $ ls
    file.svg
    $ rm file.svg

provide filename and viewer and format
    $ git-big-picture -f png -o file -v true
    warning: Filename had no suffix, using format: png
    $ ls
    file.png
    $ rm file.png

check explicit direction of history
    $ bash -c 'set -o pipefail; for i in {down,left,right,up}wards; do git-big-picture -g --history-direction=${i} | grep -F rankdir ; done'
    \trankdir="BT"; (esc)
    \trankdir="LR"; (esc)
    \trankdir="RL"; (esc)
    \trankdir="TB"; (esc)

check for deletion of temp files
    $ ls -1 "$(git-big-picture -d -v true | grep -F 'temp file' | tee /dev/stderr | grep -Eo "/[^']+" | uniq)" || ( exit 2 )  # for macOS
    debug:   Created temp file: '/[^']+' (re)
    debug:   Removing temp file: '/[^']+' (re)
    ls: .*/.+/git-big-picture.*.svg.*No such file or directory (re)
    [2]

try profiling
    $ git-big-picture --pstats=stats -o file.svg
    $ ls
    file.svg
    stats
    $ rm stats file.svg

be robust with regard to branch names that contain special characters
    $ git branch "single'tick"
    $ git branch "one'two'three"
    $ git branch 'double"quote'
    $ git-big-picture -w0 -v true

check that argument --processed produces healthy output
    $ git-big-picture --processed -f svg | head -n1 | grep -o '^<?xml'
    <?xml