forked from cadey/xesite
Within package layout (#102)
* blog: go package layout * eat my own dogfood * internal: test date * blog/go-package-layout: streamline * oops
This commit is contained in:
parent
583cf248b3
commit
eb26857c1d
|
@ -9,8 +9,8 @@ import (
|
|||
"strings"
|
||||
"time"
|
||||
|
||||
"christine.website/internal"
|
||||
"christine.website/internal/blog"
|
||||
"christine.website/cmd/site/internal"
|
||||
"christine.website/cmd/site/internal/blog"
|
||||
"github.com/prometheus/client_golang/prometheus"
|
||||
"github.com/prometheus/client_golang/prometheus/promauto"
|
||||
"within.website/ln"
|
||||
|
|
|
@ -9,7 +9,7 @@ import (
|
|||
"strings"
|
||||
"time"
|
||||
|
||||
"christine.website/internal/front"
|
||||
"christine.website/cmd/site/internal/front"
|
||||
"github.com/russross/blackfriday"
|
||||
)
|
||||
|
|
@ -5,7 +5,7 @@ import (
|
|||
)
|
||||
|
||||
func TestLoadPosts(t *testing.T) {
|
||||
posts, err := LoadPosts("../../blog", "blog")
|
||||
posts, err := LoadPosts("../../../../blog", "blog")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
@ -16,7 +16,7 @@ func TestLoadPosts(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestLoadTalks(t *testing.T) {
|
||||
talks, err := LoadPosts("../../talks", "talks")
|
||||
talks, err := LoadPosts("../../../../talks", "talks")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
@ -30,7 +30,7 @@ func TestLoadTalks(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestLoadGallery(t *testing.T) {
|
||||
gallery, err := LoadPosts("../../gallery", "gallery")
|
||||
gallery, err := LoadPosts("../../../../gallery", "gallery")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
|
@ -2,7 +2,7 @@ package internal
|
|||
|
||||
import "time"
|
||||
|
||||
const iOS13DetriFormat = `2006 M01 2`
|
||||
const iOS13DetriFormat = `2006 M1 2`
|
||||
|
||||
// IOS13Detri formats a datestamp like iOS 13 does with the Lojban locale.
|
||||
func IOS13Detri(t time.Time) string {
|
|
@ -0,0 +1,28 @@
|
|||
package internal
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"testing"
|
||||
"time"
|
||||
)
|
||||
|
||||
func TestIOS13Detri(t *testing.T) {
|
||||
cases := []struct {
|
||||
in time.Time
|
||||
out string
|
||||
}{
|
||||
{
|
||||
in: time.Date(2019, time.March, 30, 0, 0, 0, 0, time.FixedZone("UTC", 0)),
|
||||
out: "2019 M3 30",
|
||||
},
|
||||
}
|
||||
|
||||
for _, cs := range cases {
|
||||
t.Run(fmt.Sprintf("%s -> %s", cs.in.Format(time.RFC3339), cs.out), func(t *testing.T) {
|
||||
result := IOS13Detri(cs.in)
|
||||
if result != cs.out {
|
||||
t.Fatalf("wanted: %s, got: %s", cs.out, result)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
|
@ -4,7 +4,7 @@ import (
|
|||
"fmt"
|
||||
"log"
|
||||
|
||||
"christine.website/internal/front"
|
||||
"christine.website/cmd/site/internal/front"
|
||||
)
|
||||
|
||||
var markdown = []byte(`---
|
|
@ -9,7 +9,7 @@ import (
|
|||
"testing"
|
||||
"time"
|
||||
|
||||
"christine.website/internal/jsonfeed"
|
||||
"christine.website/cmd/site/internal/jsonfeed"
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
|
@ -9,9 +9,9 @@ import (
|
|||
"sort"
|
||||
"time"
|
||||
|
||||
"christine.website/internal/blog"
|
||||
"christine.website/internal/jsonfeed"
|
||||
"christine.website/internal/middleware"
|
||||
"christine.website/cmd/site/internal/blog"
|
||||
"christine.website/cmd/site/internal/jsonfeed"
|
||||
"christine.website/cmd/site/internal/middleware"
|
||||
"github.com/gorilla/feeds"
|
||||
"github.com/povilasv/prommod"
|
||||
"github.com/prometheus/client_golang/prometheus"
|
||||
|
|
|
@ -5,7 +5,7 @@ import (
|
|||
"net/http"
|
||||
"time"
|
||||
|
||||
"christine.website/internal"
|
||||
"christine.website/cmd/site/internal"
|
||||
"within.website/ln"
|
||||
"within.website/ln/opname"
|
||||
)
|
||||
|
|
Loading…
Reference in New Issue