Skip to content

Commit

Permalink
tests/check: Add unit testing for FullPath
Browse files Browse the repository at this point in the history
  • Loading branch information
bflad committed Dec 17, 2019
1 parent 918210b commit 91eff80
Showing 1 changed file with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions check/file_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
package check

import (
"testing"
)

func TestFullPath(t *testing.T) {
testCases := []struct {
Name string
FileOptions *FileOptions
Path string
Expect string
}{
{
Name: "without base path",
FileOptions: &FileOptions{},
Path: "docs/resource/thing.md",
Expect: "docs/resource/thing.md",
},
{
Name: "without base path",
FileOptions: &FileOptions{
BasePath: "/full/path/to",
},
Path: "docs/resource/thing.md",
Expect: "/full/path/to/docs/resource/thing.md",
},
}

for _, testCase := range testCases {
t.Run(testCase.Name, func(t *testing.T) {
got := testCase.FileOptions.FullPath(testCase.Path)
want := testCase.Expect

if got != want {
t.Errorf("expected %s, got %s", want, got)
}
})
}
}

0 comments on commit 91eff80

Please sign in to comment.