@@ -75,6 +75,42 @@ func TestZeroMissing(t *testing.T) {
7575 }
7676}
7777
78+ // Regression test for https://github.com/iangrunert/git-ratchet/issues/22
79+ func TestAddRemove (t * testing.T ) {
80+ if testing .Verbose () {
81+ log .SetLogThreshold (log .LevelInfo )
82+ log .SetStdoutThreshold (log .LevelInfo )
83+ }
84+
85+ createEmptyGitRepo (t )
86+
87+ runCheck (t , true , "measure-A,5" )
88+
89+ t .Logf ("Running check command with added measure w: %t z: %t i: %s" , false , false , "measure-A,5\n measure-B,4" )
90+
91+ errCode := Check ("" , 0 , false , true , "csv" , false , strings .NewReader ("measure-A,5\n measure-B,4" ))
92+
93+ if errCode != 0 {
94+ t .Fatalf ("Check command failed unexpectedly!" )
95+ }
96+
97+ t .Logf ("Running check command with added and removed measures w: %t z: %t i: %s" , false , false , "measure-B,4\n measure-C,3" )
98+
99+ errCode = Check ("" , 0 , false , true , "csv" , false , strings .NewReader ("measure-B,4\n measure-C,3" ))
100+
101+ if errCode != 50 {
102+ t .Fatalf ("Check command passed unexpectedly!" )
103+ }
104+
105+ t .Logf ("Running check command with added and removed measures w: %t z: %t i: %s" , false , true , "measure-B,4\n measure-C,3" )
106+
107+ errCode = Check ("" , 0 , false , true , "csv" , true , strings .NewReader ("measure-B,4\n measure-C,3" ))
108+
109+ if errCode != 0 {
110+ t .Fatalf ("Check command failed unexpectedly!" )
111+ }
112+ }
113+
78114func TestCheckPrefix (t * testing.T ) {
79115 if testing .Verbose () {
80116 log .SetLogThreshold (log .LevelInfo )
0 commit comments