aboutsummaryrefslogtreecommitdiff
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
parentb46f9684870f1d5302e81ac24fef3ec32ec178da (diff)
downloadxesite-4a3378cf43a35ecad32aea8947fd6c08997a755e.tar.xz
xesite-4a3378cf43a35ecad32aea8947fd6c08997a755e.zip
Dockerfile: run tests
-rw-r--r--Dockerfile3
-rw-r--r--go.mod2
-rw-r--r--go.sum4
-rw-r--r--internal/front/front_test.go42
4 files changed, 50 insertions, 1 deletions
diff --git a/Dockerfile b/Dockerfile
index 2146a58..4391948 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -2,7 +2,8 @@ FROM xena/go:1.12.1 AS build
ENV GOPROXY https://cache.greedo.xeserv.us
COPY . /site
WORKDIR /site
-RUN CGO_ENABLED=0 GOBIN=/root go install -v ./cmd/site
+RUN CGO_ENABLED=0 go test ./...
+RUN CGO_ENABLED=0 GOBIN=/root go install ./cmd/site
FROM xena/alpine
EXPOSE 5000
diff --git a/go.mod b/go.mod
index ca8e7d3..ddee490 100644
--- a/go.mod
+++ b/go.mod
@@ -14,7 +14,9 @@ require (
github.com/shurcooL/sanitized_anchor_name v1.0.0 // indirect
github.com/snabb/sitemap v1.0.0
github.com/stretchr/testify v1.3.0
+ github.com/tj/front v0.0.0-20170212063142-739be213b0a1
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 // indirect
+ gopkg.in/yaml.v1 v1.0.0-20140924161607-9f9df34309c0 // indirect
gopkg.in/yaml.v2 v2.2.1
within.website/ln v0.5.2
)
diff --git a/go.sum b/go.sum
index fa708a1..92d79d1 100644
--- a/go.sum
+++ b/go.sum
@@ -65,6 +65,8 @@ github.com/stretchr/testify v1.2.2 h1:bSDNvY7ZPG5RlJ8otE/7V6gMiyenm9RtJ7IUVIAoJ1
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q=
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
+github.com/tj/front v0.0.0-20170212063142-739be213b0a1 h1:lA+aPRvltlx2fwv/BnxyYSDQo3pIeqzHgMO5GvK0T9E=
+github.com/tj/front v0.0.0-20170212063142-739be213b0a1/go.mod h1:deJrtusCTptAW4EUn5vBLpl3dhNqPqUwEjWJz5UNxpQ=
golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
golang.org/x/net v0.0.0-20180811021610-c39426892332/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
@@ -77,6 +79,8 @@ gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLks
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY=
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
+gopkg.in/yaml.v1 v1.0.0-20140924161607-9f9df34309c0 h1:POO/ycCATvegFmVuPpQzZFJ+pGZeX22Ufu6fibxDVjU=
+gopkg.in/yaml.v1 v1.0.0-20140924161607-9f9df34309c0/go.mod h1:WDnlLJ4WF5VGsH/HVa3CI79GS0ol3YnhVnKP89i0kNg=
gopkg.in/yaml.v2 v2.2.1 h1:mUhvW9EsL+naU5Q3cakzfE91YhliOondGd6ZrsDBHQE=
gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
within.website/ln v0.5.2 h1:4pTM2wzpLjeZAputLf2U29HD79vcmdoEI/VPm2QEYgs=
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.
+}