From bcef4dc8e19c7e31f571975413d2dbfc0818ddc5 Mon Sep 17 00:00:00 2001 From: Oliver Steele Date: Sun, 25 Jun 2017 11:49:42 -0400 Subject: [PATCH] Rename some files --- ast.go => chunk_ast.go | 0 liquid_test.go => chunk_parser_test.go | 25 +++++-------------------- 2 files changed, 5 insertions(+), 20 deletions(-) rename ast.go => chunk_ast.go (100%) rename liquid_test.go => chunk_parser_test.go (57%) diff --git a/ast.go b/chunk_ast.go similarity index 100% rename from ast.go rename to chunk_ast.go diff --git a/liquid_test.go b/chunk_parser_test.go similarity index 57% rename from liquid_test.go rename to chunk_parser_test.go index f327172..df15238 100644 --- a/liquid_test.go +++ b/chunk_parser_test.go @@ -1,5 +1,3 @@ -//go:generate ragel -Z liquid.rl - package main import ( @@ -10,13 +8,7 @@ import ( "github.com/stretchr/testify/require" ) -var tests = []struct{ in, out string }{ - {"prepost", "pre:insertion:post"}, - {"pre:insertion:post", "pre:insertion:post"}, - {"post", ":insertion:post"}, -} - -func TestLiquid(t *testing.T) { +func TestChunkParser(t *testing.T) { tokens := ScanChunks("pre{%if 1%}left{{x}}right{%endif%}post", "") // fmt.Println("tokens =", tokens) ast, err := Parse(tokens) @@ -25,10 +17,8 @@ func TestLiquid(t *testing.T) { err = ast.Render(os.Stdout, nil) require.NoError(t, err) fmt.Println() - - require.True(t, true) - return + for _, test := range chunkTests { tokens := ScanChunks(test.in, "") ast, err := Parse(tokens) @@ -38,12 +28,7 @@ func TestLiquid(t *testing.T) { } } -type chunkTest struct { - in string - expected string -} - -var chunkTests = []chunkTest{ - chunkTest{"{{var}}", "value"}, - chunkTest{"{{x}}", "1"}, +var chunkTests = []struct{in, expected string}{ + {"{{var}}", "value"}, + {"{{x}}", "1"}, }