File: t0004-main.sh

package info (click to toggle)
stgit 0.19-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,748 kB
  • sloc: python: 10,558; sh: 5,739; lisp: 2,678; makefile: 142; perl: 42
file content (53 lines) | stat: -rwxr-xr-x 1,258 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
#!/bin/sh

test_description='Test stg.main'

. ./test-lib.sh

test_expect_success 'Test no command' '
    general_error stg 2>&1 |
    grep -e "usage:"
'

test_expect_success 'Test help/--help equivalence' '
    stg help 2>&1 > h0.txt &&
    stg --help 2>&1 > h1.txt &&
    diff h0.txt h1.txt
'

test_expect_success 'Test help on invalid command' '
    general_error stg help invalidcmd 2>&1 |
    grep -e "Unknown command: invalidcmd"
'

test_expect_success 'Test help on regular command' '
    stg help init | grep -e "Usage: stg init"
'

test_expect_success 'Test --help on regular command' '
    stg --help refresh | grep -e "Usage: stg refresh"
'

test_expect_success 'Test help on alias command' '
    stg help add | grep -e "Alias for \"git add"
'

test_expect_success 'Test help on ambiguous command' '
    general_error stg help pu 2>&1 |
    grep -e "Ambiguous command: pu"
'

test_expect_success 'Test version/--version equivalence' '
    stg version > v0.txt &&
    stg --version > v1.txt &&
    diff v0.txt v1.txt &&
    grep -e "Stacked GIT" v0.txt &&
    grep -F "$(git --version)" v0.txt &&
    grep -e "Python version" v0.txt
'

test_expect_success 'Test copyright' '
    stg copyright | grep -e "This program is free software"
'

test_done