test marshalling a just-a-string todo returns just-a-string
This commit is contained in:
@@ -16,6 +16,14 @@ func (todo Todo) Triggered() bool {
|
||||
return err == nil && time.Now().After(next)
|
||||
}
|
||||
|
||||
func (todo Todo) MarshalYAML() (interface{}, error) {
|
||||
if todo == (Todo{Todo: todo.Todo}) {
|
||||
return todo.Todo, nil
|
||||
}
|
||||
type Alt Todo
|
||||
return (Alt)(todo), nil
|
||||
}
|
||||
|
||||
func (todo *Todo) UnmarshalYAML(unmarshal func(interface{}) error) error {
|
||||
*todo = Todo{}
|
||||
if err := unmarshal(&todo.Todo); err == nil {
|
||||
|
||||
Reference in New Issue
Block a user