@@ -174,6 +174,7 @@ func TestDirCounter_GetHeaderAndRows(t *testing.T) {
174174 dc : wcg .NewDirCounter (testDir ),
175175 want : []wcg.Row {
176176 {"File" , "Lines" , "ChineseChars" , "NonChineseChars" , "TotalChars" },
177+ {filepath .Join (testDir , "empty.md" ), 0 , 0 , 0 , 0 },
177178 {filepath .Join (testDir , "foo.md" ), 1 , 12 , 1 , 13 },
178179 {filepath .Join (testDir , "test.md" ), 2 , 5 , 0 , 5 },
179180 {filepath .Join (testDir , "test.txt" ), 1 , 5 , 14 , 19 },
@@ -194,7 +195,8 @@ func TestDirCounter_GetHeaderAndRows(t *testing.T) {
194195
195196func TestDirCounter_ExportCSV (t * testing.T ) {
196197 testDir := filepath .Join (wd , "testdata" )
197- expectedCSV := fmt .Sprintf ("File,Lines,ChineseChars,NonChineseChars,TotalChars\n %s,1,12,1,13\n %s,2,5,0,5\n %s,1,5,14,19" ,
198+ expectedCSV := fmt .Sprintf ("File,Lines,ChineseChars,NonChineseChars,TotalChars\n %s,0,0,0,0\n %s,1,12,1,13\n %s,2,5,0,5\n %s,1,5,14,19" ,
199+ filepath .Join (testDir , "empty.md" ),
198200 filepath .Join (testDir , "foo.md" ),
199201 filepath .Join (testDir , "test.md" ),
200202 filepath .Join (testDir , "test.txt" ),
@@ -227,7 +229,8 @@ func TestDirCounter_ExportCSV(t *testing.T) {
227229
228230func TestDirCounter_ExportCSVWithFileName (t * testing.T ) {
229231 testDir := filepath .Join (wd , "testdata" )
230- expectedCSV := fmt .Sprintf ("File,Lines,ChineseChars,NonChineseChars,TotalChars\n %s,1,12,1,13\n %s,2,5,0,5\n %s,1,5,14,19" ,
232+ expectedCSV := fmt .Sprintf ("File,Lines,ChineseChars,NonChineseChars,TotalChars\n %s,0,0,0,0\n %s,1,12,1,13\n %s,2,5,0,5\n %s,1,5,14,19" ,
233+ filepath .Join (testDir , "empty.md" ),
231234 filepath .Join (testDir , "foo.md" ),
232235 filepath .Join (testDir , "test.md" ),
233236 filepath .Join (testDir , "test.txt" ),
@@ -269,6 +272,7 @@ func TestDirCounter_ExportTable(t *testing.T) {
269272 expectedTbl := table .NewWriter ()
270273 expectedTbl .AppendHeader (wcg.Row {"File" , "Lines" , "ChineseChars" , "NonChineseChars" , "TotalChars" })
271274 rows := []table.Row {
275+ {filepath .Join (testDir , "empty.md" ), 0 , 0 , 0 , 0 },
272276 {filepath .Join (testDir , "foo.md" ), 1 , 12 , 1 , 13 },
273277 {filepath .Join (testDir , "test.md" ), 2 , 5 , 0 , 5 },
274278 {filepath .Join (testDir , "test.txt" ), 1 , 5 , 14 , 19 },
0 commit comments