summaryrefslogtreecommitdiff
path: root/optional/template_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'optional/template_test.go')
-rw-r--r--optional/template_test.go34
1 files changed, 0 insertions, 34 deletions
diff --git a/optional/template_test.go b/optional/template_test.go
deleted file mode 100644
index 83b5821..0000000
--- a/optional/template_test.go
+++ /dev/null
@@ -1,34 +0,0 @@
-package optional_test
-
-import (
- "html/template"
- "log"
- "os"
-
- "xengineering.eu/optional-go/optional"
-)
-
-func Example_template() {
- data := struct {
- Flag optional.Optional[bool]
- }{
- Flag: optional.Optional[bool]{
- Value: false,
- Exists: false,
- },
- }
-
- tmpl := `Flag is: {{if .Flag.Exists}}{{.Flag.Value}}{{else}}[none]{{end}}`
-
- t, err := template.New("optional").Parse(tmpl)
- if err != nil {
- log.Fatal(err)
- }
-
- err = t.Execute(os.Stdout, data)
- if err != nil {
- log.Fatal(err)
- }
-
- // Output: Flag is: [none]
-}