Changeset 18 in code for trunk/zs_test.go
- Timestamp:
- Aug 29, 2015, 3:47:16 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/zs_test.go
r7 r18 4 4 "bytes" 5 5 "fmt" 6 "io/ioutil" 6 7 "log" 7 8 "os" … … 32 33 } 33 34 35 func tmpfile(path, s string) string { 36 ioutil.WriteFile(path, []byte(s), 0644) 37 return path 38 } 39 34 40 func TestMD(t *testing.T) { 35 v, body := md("foo.md", ` 41 defer os.Remove("foo.md") 42 v, body, _ := md(tmpfile("foo.md", ` 36 43 title: Hello, world! 37 44 keywords: foo, bar, baz … … 39 46 bayan: [:|||:] 40 47 41 this: is a content`) 48 this: is a content`)) 42 49 if v["title"] != "Hello, world!" { 43 50 t.Error() … … 57 64 58 65 // Test empty md 59 v, body = md("foo.md", "")66 v, body, _ = md(tmpfile("foo.md", "")) 60 67 if len(v) != 0 || len(body) != 0 { 61 68 t.Error(v, body) … … 63 70 64 71 // Test empty header 65 v, body = md("foo.md", "Hello")72 v, body, _ = md(tmpfile("foo.md", "Hello")) 66 73 if len(v) != 0 || body != "Hello" { 67 74 t.Error(v, body) … … 70 77 71 78 func TestRender(t *testing.T) { 72 eval := func(a []string, vars map[string]string) (string, error) {79 eval := func(a []string, vars Vars) (string, error) { 73 80 return "hello", nil 74 81 }
Note:
See TracChangeset
for help on using the changeset viewer.