Skip to content

Commit

Permalink
Add tests for Directory Visitor
Browse files Browse the repository at this point in the history
  • Loading branch information
AubreySLavigne committed Jan 11, 2019
1 parent f18f334 commit 24f5ee3
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 1 deletion.
29 changes: 29 additions & 0 deletions directory_visitor_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package main

import "testing"

func TestNewDirectoryVisitor(t *testing.T) {
tests := []struct {
dir string
flat bool
depth int
}{
{dir: "TestRootDir", flat: true, depth: 5},
{dir: "secondDir", flat: false, depth: 2},
}

for _, test := range tests {

dv := NewDirectoryVisitor(test.dir, test.flat, test.depth)

if dv.rootDir != test.dir {
t.Errorf("NewDirectoryVisitor's rootDir is incorrect. Got '%s', Expected '%s'", dv.rootDir, test.dir)
}
if dv.flatten != test.flat {
t.Errorf("NewDirectoryVisitor's flatten is incorrect. Got '%t', Expected '%t'", dv.flatten, test.flat)
}
if dv.maxDepth != test.depth {
t.Errorf("NewDirectoryVisitor's maxDepth is incorrect. Got '%d', Expected '%d'", dv.maxDepth, test.depth)
}
}
}
2 changes: 1 addition & 1 deletion groupby.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package main

// Currently 12.3% test coverage
// Currently 12.7% test coverage

import (
"flag"
Expand Down

0 comments on commit 24f5ee3

Please sign in to comment.