Refactor to try all BOM
@@ -6,11 +6,14 @@ import "testing"
// Turns out the above is due to BOM being present for that file
func TestCountStatsIssue72(t *testing.T) {
ProcessConstants()
+
+ // Try out every since BOM that we are aware of
+ for _, v := range ByteOrderMarks {
fileJob := FileJob{
Language: "C#",
}
- fileJob.Content = []byte(` // Comment 1
+ fileJob.Content = append(v, []byte(`// Comment 1
namespace Baz
{
using System;
@@ -23,12 +26,7 @@ namespace Baz
throw new NotImplementedException();
}
}
-}`)
-
- // Set the BOM
- fileJob.Content[0] = 239
- fileJob.Content[1] = 187
- fileJob.Content[2] = 191
+}`)...)
CountStats(&fileJob)
@@ -48,3 +46,4 @@ namespace Baz
t.Errorf("Expected 1 lines got %d", fileJob.Blank)
}
}
+}
