3 test_description
='Test stg.main'
7 test_expect_success
'Test no command' '
8 general_error stg 2>err &&
12 test_expect_success
'Test help/--help equivalence' '
13 stg help 2>&1 > h0.txt &&
14 stg --help 2>&1 > h1.txt &&
18 test_expect_success
'Test help on invalid command' '
19 general_error stg help invalidcmd 2>err &&
20 grep -e "Unknown command: invalidcmd" err
23 test_expect_success
'Test help on regular command' '
24 stg help init | grep -e "Usage: stg init"
27 test_expect_success
'Test --help on regular command' '
28 stg --help refresh | grep -e "Usage: stg refresh"
31 test_expect_success
'Test help on alias command' '
32 stg help add | grep -e "Alias for \"git add"
35 test_expect_success
'Test help on ambiguous command' '
36 general_error stg help pu 2>err &&
37 grep -e "Ambiguous command: pu" err
40 test_expect_success
'Test ambiguous alias' '
41 test_config stgit.alias.show-stat "git show --stat" &&
45 general_error stg sho 2>err &&
46 grep -e "Ambiguous command: sho" err
49 test_expect_success
'Test version/--version equivalence' '
50 stg version > v0.txt &&
51 stg --version > v1.txt &&
53 grep -e "Stacked Git" v0.txt &&
54 grep -F "$(git --version)" v0.txt &&
55 grep -e "Python 3\." v0.txt
58 test_expect_success
'Test copyright' '
59 stg copyright | grep -e "This program is free software"