mirror of
https://github.com/rclone/rclone.git
synced 2025-08-19 01:46:31 +02:00
fs: fix tristate conversion to JSON
This commit is contained in:
@@ -85,3 +85,18 @@ func TestTristateUnmarshalJSON(t *testing.T) {
|
||||
assert.Equal(t, test.want, got, test.in)
|
||||
}
|
||||
}
|
||||
|
||||
func TestTristateMarshalJSON(t *testing.T) {
|
||||
for _, test := range []struct {
|
||||
in Tristate
|
||||
want string
|
||||
}{
|
||||
{Tristate{}, `null`},
|
||||
{Tristate{Valid: true, Value: true}, `true`},
|
||||
{Tristate{Valid: true, Value: false}, `false`},
|
||||
} {
|
||||
got, err := json.Marshal(&test.in)
|
||||
require.NoError(t, err)
|
||||
assert.Equal(t, test.want, string(got), fmt.Sprintf("%#v", test.in))
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user