aboutsummaryrefslogtreecommitdiff
path: root/internal
diff options
context:
space:
mode:
authorChristine Dodrill <me@christine.website>2019-03-21 11:08:38 -0700
committerChristine Dodrill <me@christine.website>2019-03-21 11:08:38 -0700
commit4a3378cf43a35ecad32aea8947fd6c08997a755e (patch)
tree031775c0a24bbd0243275097ab1a3df212ba3f5d /internal
parentb46f9684870f1d5302e81ac24fef3ec32ec178da (diff)
downloadxesite-4a3378cf43a35ecad32aea8947fd6c08997a755e.tar.xz
xesite-4a3378cf43a35ecad32aea8947fd6c08997a755e.zip
Dockerfile: run tests
Diffstat (limited to 'internal')
-rw-r--r--internal/front/front_test.go42
1 files changed, 42 insertions, 0 deletions
diff --git a/internal/front/front_test.go b/internal/front/front_test.go
new file mode 100644
index 0000000..42094f5
--- /dev/null
+++ b/internal/front/front_test.go
@@ -0,0 +1,42 @@
+package front_test
+
+import (
+ "fmt"
+ "log"
+
+ "christine.website/internal/front"
+)
+
+var markdown = []byte(`---
+title: Ferrets
+authors:
+ - Tobi
+ - Loki
+ - Jane
+---
+Some content here, so
+interesting, you just
+want to keep reading.`)
+
+type article struct {
+ Title string
+ Authors []string
+}
+
+func Example() {
+ var a article
+
+ content, err := front.Unmarshal(markdown, &a)
+ if err != nil {
+ log.Fatalf("error unmarshalling: %s", err)
+ }
+
+ fmt.Printf("%#v\n", a)
+ fmt.Printf("%s\n", string(content))
+ // Output:
+ // front_test.article{Title:"Ferrets", Authors:[]string{"Tobi", "Loki", "Jane"}}
+ //
+ // Some content here, so
+ // interesting, you just
+ // want to keep reading.
+}