Skip to content

Commit

Permalink
unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
sgmiller committed Jan 10, 2025
1 parent f900b1c commit c166424
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
25 changes: 25 additions & 0 deletions options_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,3 +112,28 @@ func testOptionWithError(t *testing.T) Option {
})
}
}

func TestParsePaths(t *testing.T) {
type options struct {
optionA string
optionB string
}

test := options{
optionA: "Hello, World!",
optionB: "file://test-fixtures/secret.txt",
}
if err := ParsePaths(&test.optionA, &test.optionB); err != nil {
t.Fatal(err)
}
if test.optionB != "Top Secret" {
t.Fatalf("expected TopSecret, got %s", test.optionB)
}

test = options{
optionA: "file://test-fixtures/missing.txt",
}
if err := ParsePaths(&test.optionA, &test.optionB); err == nil {
t.Fatal("expected error but didn't get one")
}
}
1 change: 1 addition & 0 deletions test-fixtures/secret.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Top Secret

0 comments on commit c166424

Please sign in to comment.