Compare commits

..

4 commits

Author SHA1 Message Date
ced5a4e6eb
[skip ci] update error messages 2024-08-20 00:07:43 +01:00
72caa3efb4
update documentation
All checks were successful
Tests / test (pull_request) Successful in 19s
2024-08-19 22:22:15 +01:00
ef3baf7ba6
first draft of for time duration value documentation 2024-08-19 22:11:35 +01:00
1ab313e558
checkpoint: new parser for TimeDurationValue, new tests for TimeDurationValue 2024-08-19 15:46:34 +01:00
2 changed files with 0 additions and 67 deletions

View file

@ -34,5 +34,3 @@ func (b *BoolPtrValue) Set(value string) error {
return nil
}
func (b *BoolPtrValue) IsBoolFlag() bool { return true }

View file

@ -1,65 +0,0 @@
package flag_test
import (
"slices"
"testing"
internalFlag "codeflow.dananglin.me.uk/apollo/enbas/internal/flag"
)
func TestBoolPtrValue(t *testing.T) {
tests := []struct {
input string
want bool
}{
{
input: "True",
want: true,
},
{
input: "false",
want: false,
},
}
value := internalFlag.NewBoolPtrValue()
for _, test := range slices.All(tests) {
if err := value.Set(test.input); err != nil {
t.Fatalf(
"Unable to parse %s as a BoolPtrValue: %v",
test.input,
err,
)
}
got := *value.Value
if got != test.want {
t.Errorf(
"Unexpected bool parsed from %s: want %t, got %t",
test.input,
test.want,
got,
)
} else {
t.Logf(
"Expected bool parsed from %s: got %t",
test.input,
got,
)
}
}
}
func TestNilBoolPtrValue(t *testing.T) {
value := internalFlag.NewBoolPtrValue()
want := "NOT SET"
got := value.String()
if got != want {
t.Errorf("Unexpected string returned from the nil value; want %s, got %s", want, got)
} else {
t.Logf("Expected string returned from the nil value; got %s", got)
}
}