@@ -18,6 +18,7 @@ func TestNewIteration(t *testing.T) {
1818 filepath .Join (dir , "python" , "leap" , "lib" , "three.py" ),
1919 filepath .Join (dir , "python" , "leap" , "utf16le.py" ),
2020 filepath .Join (dir , "python" , "leap" , "utf16be.py" ),
21+ filepath .Join (dir , "python" , "leap" , "long-utf8.py" ),
2122 }
2223
2324 iter , err := NewIteration (dir , files )
@@ -32,25 +33,32 @@ func TestNewIteration(t *testing.T) {
3233 t .Errorf ("Expected problem to be leap, was %s" , iter .Problem )
3334 }
3435
35- if len (iter .Solution ) != 5 {
36- t .Fatalf ("Expected solution to have 3 files, had %d" , len (iter .Solution ))
36+ if len (iter .Solution ) != 6 {
37+ t .Fatalf ("Expected solution to have 6 files, had %d" , len (iter .Solution ))
3738 }
3839
39- expected := map [string ]string {
40- "one.py" : "# one" ,
41- "two.py" : "# two" ,
42- filepath .Join ("lib" , "three.py" ): "# three" ,
43- "utf16le.py" : "# utf16le" ,
44- "utf16be.py" : "# utf16be" ,
40+ expected := map [string ]struct {
41+ prefix string
42+ suffix string
43+ }{
44+ "one.py" : {prefix : "# one" },
45+ "two.py" : {prefix : "# two" },
46+ filepath .Join ("lib" , "three.py" ): {prefix : "# three" },
47+ "utf16le.py" : {prefix : "# utf16le" },
48+ "utf16be.py" : {prefix : "# utf16be" },
49+ "long-utf8.py" : {prefix : "# The first 1024" , suffix : "👍\n " },
4550 }
4651
4752 for filename , code := range expected {
4853 if ! utf8 .ValidString (iter .Solution [filename ]) {
4954 t .Errorf ("Iteration content is not valid UTF-8 data: %s" , iter .Solution [filename ])
5055 }
5156
52- if ! strings .HasPrefix (iter .Solution [filename ], code ) {
53- t .Errorf ("Expected %s to contain `%s', had `%s'" , filename , code , iter .Solution [filename ])
57+ if ! strings .HasPrefix (iter .Solution [filename ], code .prefix ) {
58+ t .Errorf ("Expected %s to start with `%s', had `%s'" , filename , code .prefix , iter .Solution [filename ])
59+ }
60+ if ! strings .HasSuffix (iter .Solution [filename ], code .suffix ) {
61+ t .Errorf ("Expected %s to end with `%s', had `%s'" , filename , code .suffix , iter .Solution [filename ])
5462 }
5563 }
5664}
0 commit comments