From 0b623d6ecf658765105acd00e409d2604d74db7c Mon Sep 17 00:00:00 2001 From: z7zmey Date: Tue, 9 Jan 2018 19:49:06 +0200 Subject: [PATCH] test numbers --- test/node/scalar/numbers_test.go | 138 +++++++++++++++++++++++++++++++ 1 file changed, 138 insertions(+) create mode 100644 test/node/scalar/numbers_test.go diff --git a/test/node/scalar/numbers_test.go b/test/node/scalar/numbers_test.go new file mode 100644 index 0000000..7d79e7e --- /dev/null +++ b/test/node/scalar/numbers_test.go @@ -0,0 +1,138 @@ +package test + +import ( + "bytes" + "reflect" + "testing" + + "github.com/kylelemons/godebug/pretty" + "github.com/z7zmey/php-parser/node" + "github.com/z7zmey/php-parser/node/scalar" + "github.com/z7zmey/php-parser/node/stmt" + "github.com/z7zmey/php-parser/parser" +) + +func assertEqual(t *testing.T, expected interface{}, actual interface{}) { + if !reflect.DeepEqual(expected, actual) { + diff := pretty.Compare(expected, actual) + + if diff != "" { + t.Errorf("diff: (-expected +actual)\n%s", diff) + } else { + t.Errorf("expected and actual are not equal\n") + } + + } +} + +func TestLNumber(t *testing.T) { + src := `