@@ -81,8 +81,8 @@ func TestByTarget(t *testing.T) {
8181 if err != nil {
8282 t .Fatal (err )
8383 }
84- if len (stages ) != 3 {
85- t .Fatalf ("expected 3 stages, got %d" , len (stages ))
84+ if len (stages ) != 4 {
85+ t .Fatalf ("expected 4 stages, got %d" , len (stages ))
8686 }
8787 t .Logf ("stages: %#v" , stages )
8888
@@ -123,6 +123,25 @@ func TestByTarget(t *testing.T) {
123123 }
124124 t .Logf ("stages4: %#v" , stages4 )
125125 assert .Equal (t , stages4 , stages2 )
126+
127+ stages5 , found := stages .ByTarget ("mytarget3" )
128+ if ! found {
129+ t .Fatal ("Fifth target not found" )
130+ }
131+ if len (stages5 ) != 1 {
132+ t .Fatalf ("expected 1 stages, got %d" , len (stages5 ))
133+ }
134+ t .Logf ("stages5: %#v" , stages5 )
135+
136+ stages6 , found := stages .ByTarget ("3" )
137+ if ! found {
138+ t .Fatal ("Sixth target not found" )
139+ }
140+ if len (stages6 ) != 1 {
141+ t .Fatalf ("expected 1 stages, got %d" , len (stages4 ))
142+ }
143+ t .Logf ("stages6: %#v" , stages6 )
144+ assert .Equal (t , stages6 , stages5 )
126145}
127146
128147func TestThroughTarget (t * testing.T ) {
@@ -134,8 +153,8 @@ func TestThroughTarget(t *testing.T) {
134153 if err != nil {
135154 t .Fatal (err )
136155 }
137- if len (stages ) != 3 {
138- t .Fatalf ("expected 3 stages, got %d" , len (stages ))
156+ if len (stages ) != 4 {
157+ t .Fatalf ("expected 4 stages, got %d" , len (stages ))
139158 }
140159 t .Logf ("stages: %#v" , stages )
141160
@@ -176,6 +195,25 @@ func TestThroughTarget(t *testing.T) {
176195 }
177196 t .Logf ("stages4: %#v" , stages4 )
178197 assert .Equal (t , stages4 , stages2 )
198+
199+ stages5 , found := stages .ThroughTarget ("mytarget3" )
200+ if ! found {
201+ t .Fatal ("Fifth target not found" )
202+ }
203+ if len (stages5 ) != 4 {
204+ t .Fatalf ("expected 4 stages, got %d" , len (stages5 ))
205+ }
206+ t .Logf ("stages5: %#v" , stages5 )
207+
208+ stages6 , found := stages .ThroughTarget ("3" )
209+ if ! found {
210+ t .Fatal ("Sixth target not found" )
211+ }
212+ if len (stages6 ) != 4 {
213+ t .Fatalf ("expected 4 stages, got %d" , len (stages4 ))
214+ }
215+ t .Logf ("stages6: %#v" , stages6 )
216+ assert .Equal (t , stages6 , stages5 )
179217}
180218
181219func TestMultiStageParse (t * testing.T ) {
0 commit comments