-
Notifications
You must be signed in to change notification settings - Fork 0
/
delta.txtar
72 lines (62 loc) · 1.47 KB
/
delta.txtar
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
# testscript framework tests for delta command line
# Basic usage test
! delta
! stdout .
stderr 'Exactly 2 arguments expected, got 0'
# buildinfo
delta buildinfo
stdout 'path github.com/fortio/delta'
! stderr .
# -foo (bad flag)
! delta -foo
! stdout .
stderr 'flag provided but not defined: -foo'
# non existent input file A
! delta foo1 foo2
stderr '\[F\] Error reading file A: open foo1: no such file or directory'
! stdout .
# non existent input file B
! delta oldFile foo2
stderr '\[F\] Error reading file B: open foo2: no such file or directory'
! stdout .
# positive test (includes order of A/B iteration swap)
delta -loglevel verbose -b 'echo NEW:' -a 'echo REMOVED:' oldFile newFile
cmp stdout expected1
stderr 'Fortio delta.*started - will run "echo REMOVED:" on entries unique to oldFile, and "echo NEW:" on ones unique to newFile'
# swapping a and b test
delta -loglevel verbose -a 'echo NEW:' -b 'echo REMOVED:' newFile oldFile
cmp stdout expected2
# command errors out (with -a)
! delta -a false oldFile newFile
stderr '\[E\] Error running .*false gone 2: exit status 1'
# command errors out (with -b)
! delta -b false oldFile newFile
stderr '\[E\] Error running .*false new1: exit status 1'
-- expected1 --
REMOVED: gone 2
REMOVED: gone1
REMOVED: goneA
REMOVED: goneZ
NEW: new1
NEW: new2
-- expected2 --
NEW: new1
NEW: new2
REMOVED: gone 2
REMOVED: gone1
REMOVED: goneA
REMOVED: goneZ
-- oldFile --
goneZ
old1
goneA
old2
gone1
old3
gone 2
-- newFile --
new1
old1
old2
old3
new2