Skip to content

Commit

Permalink
Test case for main
Browse files Browse the repository at this point in the history
  • Loading branch information
osteele committed Jul 15, 2017
1 parent 724da61 commit 6a3a853
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
8 changes: 7 additions & 1 deletion cmd/liquid/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,15 @@ import (

func TestMain(t *testing.T) {
src := `{{ "Hello World" | downcase | split: " " | first | append: "!"}}`
stdin = bytes.NewBufferString(src)
buf := new(bytes.Buffer)
stdin = bytes.NewBufferString(src)
stdout = buf
require.NoError(t, run([]string{}))
require.Equal(t, "hello!", buf.String())

buf = new(bytes.Buffer)
stdin = bytes.NewBufferString("")
stdout = buf
require.NoError(t, run([]string{"testdata/source.txt"}))
require.Contains(t, buf.String(), "file system")
}
1 change: 1 addition & 0 deletions cmd/liquid/testdata/source.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{% capture horse %}file system{% endcapture %}Now I'm on a {{ horse }}!

0 comments on commit 6a3a853

Please sign in to comment.