From 6f7834eb6b8b7f76a42aa8ca3377888845456341 Mon Sep 17 00:00:00 2001 From: z7zmey Date: Tue, 10 Apr 2018 15:23:13 +0300 Subject: [PATCH] issue #8: update tests --- node/expr/assign/t_assign_op_test.go | 128 +++++++++---- node/expr/binary/t_binary_op_test.go | 208 ++++++++++++++++------ node/expr/cast/t_cast_test.go | 80 ++++++--- node/expr/t_array_dim_fetch_test.go | 16 +- node/expr/t_array_test.go | 24 ++- node/expr/t_bitwise_not_test.go | 8 +- node/expr/t_boolean_not_test.go | 8 +- node/expr/t_class_const_fetch_test.go | 16 +- node/expr/t_clone_test.go | 16 +- node/expr/t_closure_test.go | 28 ++- node/expr/t_const_fetch_test.go | 24 ++- node/expr/t_empty_test.go | 8 +- node/expr/t_error_supress_test.go | 8 +- node/expr/t_eval_test.go | 8 +- node/expr/t_exit_test.go | 32 +++- node/expr/t_function_call_test.go | 40 +++-- node/expr/t_inc_dec_test.go | 32 +++- node/expr/t_include_test.go | 32 +++- node/expr/t_instance_of_test.go | 24 ++- node/expr/t_isset_test.go | 16 +- node/expr/t_list_test.go | 32 +++- node/expr/t_method_call_test.go | 8 +- node/expr/t_new_test.go | 28 ++- node/expr/t_print_test.go | 8 +- node/expr/t_property_fetch_test.go | 8 +- node/expr/t_shell_exec_test.go | 8 +- node/expr/t_short_array_test.go | 24 ++- node/expr/t_short_list_test.go | 12 +- node/expr/t_static_call_test.go | 40 +++-- node/expr/t_static_property_fetch_test.go | 24 ++- node/expr/t_ternary_test.go | 32 +++- node/expr/t_unary_test.go | 16 +- node/expr/t_variable_test.go | 16 +- node/expr/t_yield_test.go | 44 +++-- node/name/t_name_test.go | 24 ++- node/scalar/t_encapsed_test.go | 64 +++++-- node/scalar/t_heredoc_test.go | 40 +++-- node/scalar/t_magic_constant_test.go | 8 +- node/scalar/t_numbers_test.go | 56 ++++-- node/scalar/t_string_test.go | 40 +++-- node/stmt/t_alt_if_test.go | 32 +++- node/stmt/t_class_const_list_test.go | 12 +- node/stmt/t_class_method_test.go | 36 +++- node/stmt/t_class_test.go | 44 +++-- node/stmt/t_const_list_test.go | 8 +- node/stmt/t_continue_test.go | 24 ++- node/stmt/t_declare_test.go | 24 ++- node/stmt/t_do_test.go | 8 +- node/stmt/t_echo_test.go | 16 +- node/stmt/t_expression_test.go | 8 +- node/stmt/t_for_test.go | 16 +- node/stmt/t_foreach_test.go | 56 ++++-- node/stmt/t_function_test.go | 36 +++- node/stmt/t_global_test.go | 16 +- node/stmt/t_goto_label_test.go | 8 +- node/stmt/t_halt_compiler_test.go | 8 +- node/stmt/t_if_test.go | 40 +++-- node/stmt/t_inline_html_test.go | 8 +- node/stmt/t_interface_test.go | 24 ++- node/stmt/t_namespace_test.go | 24 ++- node/stmt/t_property_list_test.go | 24 ++- node/stmt/t_static_var_test.go | 24 ++- node/stmt/t_switch_case_default_test.go | 32 +++- node/stmt/t_throw_test.go | 8 +- node/stmt/t_trait_test.go | 8 +- node/stmt/t_trait_use_test.go | 48 +++-- node/stmt/t_try_catch_finnaly_test.go | 44 +++-- node/stmt/t_unset_test.go | 20 ++- node/stmt/t_use_test.go | 92 +++++++--- node/stmt/t_while_break_test.go | 24 ++- node/t_node_test.go | 32 +++- php5/php5_bench_test.go | 3 +- php5/php5_test.go | 12 +- php7/php7_bench_test.go | 3 +- php7/php7_test.go | 12 +- visitor/dumper_test.go | 8 +- 76 files changed, 1596 insertions(+), 534 deletions(-) diff --git a/node/expr/assign/t_assign_op_test.go b/node/expr/assign/t_assign_op_test.go index d337d8e..a901fae 100644 --- a/node/expr/assign/t_assign_op_test.go +++ b/node/expr/assign/t_assign_op_test.go @@ -43,10 +43,14 @@ func TestReference(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) - actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php") + php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php") + php5parser.Parse() + actual = php5parser.GetRootNode() assertEqual(t, expected, actual) } @@ -70,10 +74,14 @@ func TestReferenceNew(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) - actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php") + php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php") + php5parser.Parse() + actual = php5parser.GetRootNode() assertEqual(t, expected, actual) } @@ -104,10 +112,14 @@ func TestReferenceArgs(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) - actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php") + php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php") + php5parser.Parse() + actual = php5parser.GetRootNode() assertEqual(t, expected, actual) } @@ -125,10 +137,14 @@ func TestAssign(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) - actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php") + php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php") + php5parser.Parse() + actual = php5parser.GetRootNode() assertEqual(t, expected, actual) } @@ -146,10 +162,14 @@ func TestBitwiseAnd(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) - actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php") + php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php") + php5parser.Parse() + actual = php5parser.GetRootNode() assertEqual(t, expected, actual) } @@ -167,10 +187,14 @@ func TestBitwiseOr(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) - actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php") + php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php") + php5parser.Parse() + actual = php5parser.GetRootNode() assertEqual(t, expected, actual) } @@ -188,10 +212,14 @@ func TestBitwiseXor(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) - actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php") + php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php") + php5parser.Parse() + actual = php5parser.GetRootNode() assertEqual(t, expected, actual) } @@ -209,10 +237,14 @@ func TestConcat(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) - actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php") + php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php") + php5parser.Parse() + actual = php5parser.GetRootNode() assertEqual(t, expected, actual) } @@ -230,10 +262,14 @@ func TestDiv(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) - actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php") + php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php") + php5parser.Parse() + actual = php5parser.GetRootNode() assertEqual(t, expected, actual) } @@ -251,10 +287,14 @@ func TestMinus(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) - actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php") + php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php") + php5parser.Parse() + actual = php5parser.GetRootNode() assertEqual(t, expected, actual) } @@ -272,10 +312,14 @@ func TestMod(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) - actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php") + php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php") + php5parser.Parse() + actual = php5parser.GetRootNode() assertEqual(t, expected, actual) } @@ -293,10 +337,14 @@ func TestMul(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) - actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php") + php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php") + php5parser.Parse() + actual = php5parser.GetRootNode() assertEqual(t, expected, actual) } @@ -314,10 +362,14 @@ func TestPlus(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) - actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php") + php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php") + php5parser.Parse() + actual = php5parser.GetRootNode() assertEqual(t, expected, actual) } @@ -335,10 +387,14 @@ func TestPow(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) - actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php") + php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php") + php5parser.Parse() + actual = php5parser.GetRootNode() assertEqual(t, expected, actual) } @@ -356,10 +412,14 @@ func TestShiftLeft(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) - actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php") + php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php") + php5parser.Parse() + actual = php5parser.GetRootNode() assertEqual(t, expected, actual) } @@ -377,9 +437,13 @@ func TestShiftRight(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) - actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php") + php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php") + php5parser.Parse() + actual = php5parser.GetRootNode() assertEqual(t, expected, actual) } diff --git a/node/expr/binary/t_binary_op_test.go b/node/expr/binary/t_binary_op_test.go index cb55c6a..414af88 100644 --- a/node/expr/binary/t_binary_op_test.go +++ b/node/expr/binary/t_binary_op_test.go @@ -41,10 +41,14 @@ func TestBitwiseAnd(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) - actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php") + php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php") + php5parser.Parse() + actual = php5parser.GetRootNode() assertEqual(t, expected, actual) } @@ -62,10 +66,14 @@ func TestBitwiseOr(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) - actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php") + php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php") + php5parser.Parse() + actual = php5parser.GetRootNode() assertEqual(t, expected, actual) } @@ -83,10 +91,14 @@ func TestBitwiseXor(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) - actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php") + php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php") + php5parser.Parse() + actual = php5parser.GetRootNode() assertEqual(t, expected, actual) } @@ -104,10 +116,14 @@ func TestBooleanAnd(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) - actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php") + php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php") + php5parser.Parse() + actual = php5parser.GetRootNode() assertEqual(t, expected, actual) } @@ -125,10 +141,14 @@ func TestBooleanOr(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) - actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php") + php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php") + php5parser.Parse() + actual = php5parser.GetRootNode() assertEqual(t, expected, actual) } @@ -146,7 +166,9 @@ func TestCoalesce(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) } @@ -164,10 +186,14 @@ func TestConcat(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) - actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php") + php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php") + php5parser.Parse() + actual = php5parser.GetRootNode() assertEqual(t, expected, actual) } @@ -185,10 +211,14 @@ func TestDiv(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) - actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php") + php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php") + php5parser.Parse() + actual = php5parser.GetRootNode() assertEqual(t, expected, actual) } @@ -206,10 +236,14 @@ func TestEqual(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) - actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php") + php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php") + php5parser.Parse() + actual = php5parser.GetRootNode() assertEqual(t, expected, actual) } @@ -227,10 +261,14 @@ func TestGreaterOrEqual(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) - actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php") + php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php") + php5parser.Parse() + actual = php5parser.GetRootNode() assertEqual(t, expected, actual) } @@ -248,10 +286,14 @@ func TestGreater(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) - actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php") + php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php") + php5parser.Parse() + actual = php5parser.GetRootNode() assertEqual(t, expected, actual) } @@ -269,10 +311,14 @@ func TestIdentical(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) - actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php") + php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php") + php5parser.Parse() + actual = php5parser.GetRootNode() assertEqual(t, expected, actual) } @@ -290,10 +336,14 @@ func TestLogicalAnd(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) - actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php") + php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php") + php5parser.Parse() + actual = php5parser.GetRootNode() assertEqual(t, expected, actual) } @@ -311,10 +361,14 @@ func TestLogicalOr(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) - actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php") + php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php") + php5parser.Parse() + actual = php5parser.GetRootNode() assertEqual(t, expected, actual) } @@ -332,10 +386,14 @@ func TestLogicalXor(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) - actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php") + php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php") + php5parser.Parse() + actual = php5parser.GetRootNode() assertEqual(t, expected, actual) } @@ -353,10 +411,14 @@ func TestMinus(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) - actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php") + php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php") + php5parser.Parse() + actual = php5parser.GetRootNode() assertEqual(t, expected, actual) } @@ -374,10 +436,14 @@ func TestMod(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) - actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php") + php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php") + php5parser.Parse() + actual = php5parser.GetRootNode() assertEqual(t, expected, actual) } @@ -395,10 +461,14 @@ func TestMul(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) - actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php") + php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php") + php5parser.Parse() + actual = php5parser.GetRootNode() assertEqual(t, expected, actual) } @@ -416,10 +486,14 @@ func TestNotEqual(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) - actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php") + php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php") + php5parser.Parse() + actual = php5parser.GetRootNode() assertEqual(t, expected, actual) } @@ -437,10 +511,14 @@ func TestNotIdentical(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) - actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php") + php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php") + php5parser.Parse() + actual = php5parser.GetRootNode() assertEqual(t, expected, actual) } @@ -458,10 +536,14 @@ func TestPlus(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) - actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php") + php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php") + php5parser.Parse() + actual = php5parser.GetRootNode() assertEqual(t, expected, actual) } @@ -479,10 +561,14 @@ func TestPow(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) - actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php") + php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php") + php5parser.Parse() + actual = php5parser.GetRootNode() assertEqual(t, expected, actual) } @@ -500,10 +586,14 @@ func TestShiftLeft(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) - actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php") + php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php") + php5parser.Parse() + actual = php5parser.GetRootNode() assertEqual(t, expected, actual) } @@ -521,10 +611,14 @@ func TestShiftRight(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) - actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php") + php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php") + php5parser.Parse() + actual = php5parser.GetRootNode() assertEqual(t, expected, actual) } @@ -542,10 +636,14 @@ func TestSmallerOrEqual(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) - actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php") + php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php") + php5parser.Parse() + actual = php5parser.GetRootNode() assertEqual(t, expected, actual) } @@ -563,10 +661,14 @@ func TestSmaller(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) - actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php") + php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php") + php5parser.Parse() + actual = php5parser.GetRootNode() assertEqual(t, expected, actual) } @@ -584,6 +686,8 @@ func TestSpaceship(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) } diff --git a/node/expr/cast/t_cast_test.go b/node/expr/cast/t_cast_test.go index ba4c601..c8a0246 100644 --- a/node/expr/cast/t_cast_test.go +++ b/node/expr/cast/t_cast_test.go @@ -40,10 +40,14 @@ func TestArray(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) - actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php") + php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php") + php5parser.Parse() + actual = php5parser.GetRootNode() assertEqual(t, expected, actual) } @@ -60,10 +64,14 @@ func TestBool(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) - actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php") + php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php") + php5parser.Parse() + actual = php5parser.GetRootNode() assertEqual(t, expected, actual) } @@ -80,10 +88,14 @@ func TestBoolShort(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) - actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php") + php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php") + php5parser.Parse() + actual = php5parser.GetRootNode() assertEqual(t, expected, actual) } @@ -100,10 +112,14 @@ func TestDouble(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) - actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php") + php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php") + php5parser.Parse() + actual = php5parser.GetRootNode() assertEqual(t, expected, actual) } @@ -120,10 +136,14 @@ func TestCastFloat(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) - actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php") + php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php") + php5parser.Parse() + actual = php5parser.GetRootNode() assertEqual(t, expected, actual) } @@ -140,10 +160,14 @@ func TestInt(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) - actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php") + php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php") + php5parser.Parse() + actual = php5parser.GetRootNode() assertEqual(t, expected, actual) } @@ -160,10 +184,14 @@ func TestIntShort(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) - actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php") + php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php") + php5parser.Parse() + actual = php5parser.GetRootNode() assertEqual(t, expected, actual) } @@ -180,10 +208,14 @@ func TestObject(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) - actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php") + php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php") + php5parser.Parse() + actual = php5parser.GetRootNode() assertEqual(t, expected, actual) } @@ -200,10 +232,14 @@ func TestString(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) - actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php") + php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php") + php5parser.Parse() + actual = php5parser.GetRootNode() assertEqual(t, expected, actual) } @@ -220,9 +256,13 @@ func TestUnset(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) - actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php") + php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php") + php5parser.Parse() + actual = php5parser.GetRootNode() assertEqual(t, expected, actual) } diff --git a/node/expr/t_array_dim_fetch_test.go b/node/expr/t_array_dim_fetch_test.go index 51a2da6..caab5e6 100644 --- a/node/expr/t_array_dim_fetch_test.go +++ b/node/expr/t_array_dim_fetch_test.go @@ -42,10 +42,14 @@ func TestArrayDimFetch(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) - actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php") + php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php") + php5parser.Parse() + actual = php5parser.GetRootNode() assertEqual(t, expected, actual) } @@ -66,9 +70,13 @@ func TestArrayDimFetchNested(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) - actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php") + php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php") + php5parser.Parse() + actual = php5parser.GetRootNode() assertEqual(t, expected, actual) } diff --git a/node/expr/t_array_test.go b/node/expr/t_array_test.go index dac4aa6..caa083a 100644 --- a/node/expr/t_array_test.go +++ b/node/expr/t_array_test.go @@ -27,10 +27,14 @@ func TestArray(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) - actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php") + php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php") + php5parser.Parse() + actual = php5parser.GetRootNode() assertEqual(t, expected, actual) } @@ -52,10 +56,14 @@ func TestArrayItem(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) - actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php") + php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php") + php5parser.Parse() + actual = php5parser.GetRootNode() assertEqual(t, expected, actual) } @@ -82,9 +90,13 @@ func TestArrayItems(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) - actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php") + php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php") + php5parser.Parse() + actual = php5parser.GetRootNode() assertEqual(t, expected, actual) } diff --git a/node/expr/t_bitwise_not_test.go b/node/expr/t_bitwise_not_test.go index 5dcf1a0..2cf5f72 100644 --- a/node/expr/t_bitwise_not_test.go +++ b/node/expr/t_bitwise_not_test.go @@ -25,9 +25,13 @@ func TestBitwiseNot(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) - actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php") + php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php") + php5parser.Parse() + actual = php5parser.GetRootNode() assertEqual(t, expected, actual) } diff --git a/node/expr/t_boolean_not_test.go b/node/expr/t_boolean_not_test.go index 783dd90..24f59d5 100644 --- a/node/expr/t_boolean_not_test.go +++ b/node/expr/t_boolean_not_test.go @@ -25,9 +25,13 @@ func TestBooleanNot(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) - actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php") + php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php") + php5parser.Parse() + actual = php5parser.GetRootNode() assertEqual(t, expected, actual) } diff --git a/node/expr/t_class_const_fetch_test.go b/node/expr/t_class_const_fetch_test.go index 033b5e6..cca3753 100644 --- a/node/expr/t_class_const_fetch_test.go +++ b/node/expr/t_class_const_fetch_test.go @@ -32,10 +32,14 @@ func TestClassConstFetch(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) - actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php") + php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php") + php5parser.Parse() + actual = php5parser.GetRootNode() assertEqual(t, expected, actual) } @@ -53,9 +57,13 @@ func TestStaticClassConstFetch(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) - actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php") + php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php") + php5parser.Parse() + actual = php5parser.GetRootNode() assertEqual(t, expected, actual) } diff --git a/node/expr/t_clone_test.go b/node/expr/t_clone_test.go index f094d8a..8a5c1ed 100644 --- a/node/expr/t_clone_test.go +++ b/node/expr/t_clone_test.go @@ -25,10 +25,14 @@ func TestCloneBrackets(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) - actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php") + php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php") + php5parser.Parse() + actual = php5parser.GetRootNode() assertEqual(t, expected, actual) } @@ -45,9 +49,13 @@ func TestClone(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) - actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php") + php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php") + php5parser.Parse() + actual = php5parser.GetRootNode() assertEqual(t, expected, actual) } diff --git a/node/expr/t_closure_test.go b/node/expr/t_closure_test.go index 7165653..7aa923c 100644 --- a/node/expr/t_closure_test.go +++ b/node/expr/t_closure_test.go @@ -31,10 +31,14 @@ func TestClosure(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) - actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php") + php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php") + php5parser.Parse() + actual = php5parser.GetRootNode() assertEqual(t, expected, actual) } @@ -76,10 +80,14 @@ func TestClosureUse(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) - actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php") + php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php") + php5parser.Parse() + actual = php5parser.GetRootNode() assertEqual(t, expected, actual) } @@ -121,10 +129,14 @@ func TestClosureUse2(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) - actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php") + php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php") + php5parser.Parse() + actual = php5parser.GetRootNode() assertEqual(t, expected, actual) } @@ -148,6 +160,8 @@ func TestClosureReturnType(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) } diff --git a/node/expr/t_const_fetch_test.go b/node/expr/t_const_fetch_test.go index cabf7d9..4300a99 100644 --- a/node/expr/t_const_fetch_test.go +++ b/node/expr/t_const_fetch_test.go @@ -27,10 +27,14 @@ func TestConstFetch(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) - actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php") + php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php") + php5parser.Parse() + actual = php5parser.GetRootNode() assertEqual(t, expected, actual) } @@ -47,10 +51,14 @@ func TestConstFetchRelative(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) - actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php") + php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php") + php5parser.Parse() + actual = php5parser.GetRootNode() assertEqual(t, expected, actual) } @@ -67,9 +75,13 @@ func TestConstFetchFullyQualified(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) - actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php") + php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php") + php5parser.Parse() + actual = php5parser.GetRootNode() assertEqual(t, expected, actual) } diff --git a/node/expr/t_empty_test.go b/node/expr/t_empty_test.go index 47be4e7..bcd5f28 100644 --- a/node/expr/t_empty_test.go +++ b/node/expr/t_empty_test.go @@ -25,9 +25,13 @@ func TestEmpty(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) - actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php") + php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php") + php5parser.Parse() + actual = php5parser.GetRootNode() assertEqual(t, expected, actual) } diff --git a/node/expr/t_error_supress_test.go b/node/expr/t_error_supress_test.go index ce538f7..4565eaf 100644 --- a/node/expr/t_error_supress_test.go +++ b/node/expr/t_error_supress_test.go @@ -25,9 +25,13 @@ func TestErrorSuppress(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) - actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php") + php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php") + php5parser.Parse() + actual = php5parser.GetRootNode() assertEqual(t, expected, actual) } diff --git a/node/expr/t_eval_test.go b/node/expr/t_eval_test.go index 44f59f0..4d08099 100644 --- a/node/expr/t_eval_test.go +++ b/node/expr/t_eval_test.go @@ -25,9 +25,13 @@ func TestEval(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) - actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php") + php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php") + php5parser.Parse() + actual = php5parser.GetRootNode() assertEqual(t, expected, actual) } diff --git a/node/expr/t_exit_test.go b/node/expr/t_exit_test.go index 5ec24dc..ac3b3bb 100644 --- a/node/expr/t_exit_test.go +++ b/node/expr/t_exit_test.go @@ -23,10 +23,14 @@ func TestExit(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) - actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php") + php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php") + php5parser.Parse() + actual = php5parser.GetRootNode() assertEqual(t, expected, actual) } @@ -43,10 +47,14 @@ func TestExitExpr(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) - actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php") + php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php") + php5parser.Parse() + actual = php5parser.GetRootNode() assertEqual(t, expected, actual) } @@ -61,10 +69,14 @@ func TestDie(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) - actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php") + php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php") + php5parser.Parse() + actual = php5parser.GetRootNode() assertEqual(t, expected, actual) } @@ -81,9 +93,13 @@ func TestDieExpr(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) - actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php") + php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php") + php5parser.Parse() + actual = php5parser.GetRootNode() assertEqual(t, expected, actual) } diff --git a/node/expr/t_function_call_test.go b/node/expr/t_function_call_test.go index 4e03596..03d4c33 100644 --- a/node/expr/t_function_call_test.go +++ b/node/expr/t_function_call_test.go @@ -35,10 +35,14 @@ func TestFunctionCall(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) - actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php") + php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php") + php5parser.Parse() + actual = php5parser.GetRootNode() assertEqual(t, expected, actual) } @@ -60,10 +64,14 @@ func TestFunctionCallRelative(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) - actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php") + php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php") + php5parser.Parse() + actual = php5parser.GetRootNode() assertEqual(t, expected, actual) } @@ -93,10 +101,14 @@ func TestFunctionFullyQualified(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) - actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php") + php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php") + php5parser.Parse() + actual = php5parser.GetRootNode() assertEqual(t, expected, actual) } @@ -122,10 +134,14 @@ func TestFunctionCallVar(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) - actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php") + php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php") + php5parser.Parse() + actual = php5parser.GetRootNode() assertEqual(t, expected, actual) } @@ -156,9 +172,13 @@ func TestFunctionCallExprArg(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) - actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php") + php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php") + php5parser.Parse() + actual = php5parser.GetRootNode() assertEqual(t, expected, actual) } diff --git a/node/expr/t_inc_dec_test.go b/node/expr/t_inc_dec_test.go index 1dbe1f9..29d1cb7 100644 --- a/node/expr/t_inc_dec_test.go +++ b/node/expr/t_inc_dec_test.go @@ -25,10 +25,14 @@ func TestPostDec(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) - actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php") + php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php") + php5parser.Parse() + actual = php5parser.GetRootNode() assertEqual(t, expected, actual) } @@ -45,10 +49,14 @@ func TestPostInc(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) - actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php") + php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php") + php5parser.Parse() + actual = php5parser.GetRootNode() assertEqual(t, expected, actual) } @@ -65,10 +73,14 @@ func TestPreDec(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) - actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php") + php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php") + php5parser.Parse() + actual = php5parser.GetRootNode() assertEqual(t, expected, actual) } @@ -85,9 +97,13 @@ func TestPreInc(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) - actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php") + php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php") + php5parser.Parse() + actual = php5parser.GetRootNode() assertEqual(t, expected, actual) } diff --git a/node/expr/t_include_test.go b/node/expr/t_include_test.go index 3be7943..0f7580c 100644 --- a/node/expr/t_include_test.go +++ b/node/expr/t_include_test.go @@ -25,10 +25,14 @@ func TestInclude(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) - actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php") + php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php") + php5parser.Parse() + actual = php5parser.GetRootNode() assertEqual(t, expected, actual) } @@ -45,10 +49,14 @@ func TestIncludeOnce(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) - actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php") + php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php") + php5parser.Parse() + actual = php5parser.GetRootNode() assertEqual(t, expected, actual) } @@ -65,10 +73,14 @@ func TestRequire(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) - actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php") + php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php") + php5parser.Parse() + actual = php5parser.GetRootNode() assertEqual(t, expected, actual) } @@ -85,9 +97,13 @@ func TestRequireOnce(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) - actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php") + php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php") + php5parser.Parse() + actual = php5parser.GetRootNode() assertEqual(t, expected, actual) } diff --git a/node/expr/t_instance_of_test.go b/node/expr/t_instance_of_test.go index 9326209..59c96cb 100644 --- a/node/expr/t_instance_of_test.go +++ b/node/expr/t_instance_of_test.go @@ -32,10 +32,14 @@ func TestInstanceOf(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) - actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php") + php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php") + php5parser.Parse() + actual = php5parser.GetRootNode() assertEqual(t, expected, actual) } @@ -57,10 +61,14 @@ func TestInstanceOfRelative(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) - actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php") + php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php") + php5parser.Parse() + actual = php5parser.GetRootNode() assertEqual(t, expected, actual) } @@ -82,9 +90,13 @@ func TestInstanceOfFullyQualified(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) - actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php") + php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php") + php5parser.Parse() + actual = php5parser.GetRootNode() assertEqual(t, expected, actual) } diff --git a/node/expr/t_isset_test.go b/node/expr/t_isset_test.go index 3ae39c7..06c39de 100644 --- a/node/expr/t_isset_test.go +++ b/node/expr/t_isset_test.go @@ -27,10 +27,14 @@ func TestIsset(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) - actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php") + php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php") + php5parser.Parse() + actual = php5parser.GetRootNode() assertEqual(t, expected, actual) } @@ -50,9 +54,13 @@ func TestIssetVariables(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) - actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php") + php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php") + php5parser.Parse() + actual = php5parser.GetRootNode() assertEqual(t, expected, actual) } diff --git a/node/expr/t_list_test.go b/node/expr/t_list_test.go index f7872f7..4131583 100644 --- a/node/expr/t_list_test.go +++ b/node/expr/t_list_test.go @@ -30,10 +30,14 @@ func TestEmptyList(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) - actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php") + php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php") + php5parser.Parse() + actual = php5parser.GetRootNode() assertEqual(t, expected, actual) } @@ -58,10 +62,14 @@ func TestList(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) - actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php") + php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php") + php5parser.Parse() + actual = php5parser.GetRootNode() assertEqual(t, expected, actual) } @@ -88,10 +96,14 @@ func TestListArrayIndex(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) - actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php") + php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php") + php5parser.Parse() + actual = php5parser.GetRootNode() assertEqual(t, expected, actual) } @@ -123,9 +135,13 @@ func TestListList(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) - actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php") + php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php") + php5parser.Parse() + actual = php5parser.GetRootNode() assertEqual(t, expected, actual) } diff --git a/node/expr/t_method_call_test.go b/node/expr/t_method_call_test.go index d157a3f..bcd5376 100644 --- a/node/expr/t_method_call_test.go +++ b/node/expr/t_method_call_test.go @@ -27,9 +27,13 @@ func TestMethodCall(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) - actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php") + php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php") + php5parser.Parse() + actual = php5parser.GetRootNode() assertEqual(t, expected, actual) } diff --git a/node/expr/t_new_test.go b/node/expr/t_new_test.go index 49242f9..656abdf 100644 --- a/node/expr/t_new_test.go +++ b/node/expr/t_new_test.go @@ -31,10 +31,14 @@ func TestNew(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) - actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php") + php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php") + php5parser.Parse() + actual = php5parser.GetRootNode() assertEqual(t, expected, actual) } @@ -56,10 +60,14 @@ func TestNewRelative(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) - actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php") + php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php") + php5parser.Parse() + actual = php5parser.GetRootNode() assertEqual(t, expected, actual) } @@ -81,10 +89,14 @@ func TestNewFullyQualified(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) - actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php") + php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php") + php5parser.Parse() + actual = php5parser.GetRootNode() assertEqual(t, expected, actual) } @@ -108,6 +120,8 @@ func TestNewAnonymous(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) } diff --git a/node/expr/t_print_test.go b/node/expr/t_print_test.go index c58cc60..f1bfcc1 100644 --- a/node/expr/t_print_test.go +++ b/node/expr/t_print_test.go @@ -25,9 +25,13 @@ func TestPrint(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) - actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php") + php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php") + php5parser.Parse() + actual = php5parser.GetRootNode() assertEqual(t, expected, actual) } diff --git a/node/expr/t_property_fetch_test.go b/node/expr/t_property_fetch_test.go index 15fa3b1..9948ed0 100644 --- a/node/expr/t_property_fetch_test.go +++ b/node/expr/t_property_fetch_test.go @@ -26,9 +26,13 @@ func TestPropertyFetch(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) - actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php") + php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php") + php5parser.Parse() + actual = php5parser.GetRootNode() assertEqual(t, expected, actual) } diff --git a/node/expr/t_shell_exec_test.go b/node/expr/t_shell_exec_test.go index cc54de3..824c453 100644 --- a/node/expr/t_shell_exec_test.go +++ b/node/expr/t_shell_exec_test.go @@ -30,9 +30,13 @@ func TestShellExec(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) - actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php") + php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php") + php5parser.Parse() + actual = php5parser.GetRootNode() assertEqual(t, expected, actual) } diff --git a/node/expr/t_short_array_test.go b/node/expr/t_short_array_test.go index 4023ea3..7ea7e02 100644 --- a/node/expr/t_short_array_test.go +++ b/node/expr/t_short_array_test.go @@ -27,10 +27,14 @@ func TestShortArray(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) - actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php") + php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php") + php5parser.Parse() + actual = php5parser.GetRootNode() assertEqual(t, expected, actual) } @@ -52,10 +56,14 @@ func TestShortArrayItem(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) - actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php") + php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php") + php5parser.Parse() + actual = php5parser.GetRootNode() assertEqual(t, expected, actual) } @@ -82,9 +90,13 @@ func TestShortArrayItems(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) - actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php") + php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php") + php5parser.Parse() + actual = php5parser.GetRootNode() assertEqual(t, expected, actual) } diff --git a/node/expr/t_short_list_test.go b/node/expr/t_short_list_test.go index be6b031..98a6a8a 100644 --- a/node/expr/t_short_list_test.go +++ b/node/expr/t_short_list_test.go @@ -34,7 +34,9 @@ func TestShortList(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) } @@ -61,7 +63,9 @@ func TestShortListArrayIndex(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) } @@ -93,6 +97,8 @@ func TestShortListList(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) } diff --git a/node/expr/t_static_call_test.go b/node/expr/t_static_call_test.go index d5217bd..4b03128 100644 --- a/node/expr/t_static_call_test.go +++ b/node/expr/t_static_call_test.go @@ -33,10 +33,14 @@ func TestStaticCall(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) - actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php") + php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php") + php5parser.Parse() + actual = php5parser.GetRootNode() assertEqual(t, expected, actual) } @@ -59,10 +63,14 @@ func TestStaticCallRelative(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) - actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php") + php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php") + php5parser.Parse() + actual = php5parser.GetRootNode() assertEqual(t, expected, actual) } @@ -85,10 +93,14 @@ func TestStaticCallFullyQualified(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) - actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php") + php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php") + php5parser.Parse() + actual = php5parser.GetRootNode() assertEqual(t, expected, actual) } @@ -111,10 +123,14 @@ func TestStaticCallVar(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) - actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php") + php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php") + php5parser.Parse() + actual = php5parser.GetRootNode() assertEqual(t, expected, actual) } @@ -133,9 +149,13 @@ func TestStaticCallVarVar(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) - actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php") + php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php") + php5parser.Parse() + actual = php5parser.GetRootNode() assertEqual(t, expected, actual) } diff --git a/node/expr/t_static_property_fetch_test.go b/node/expr/t_static_property_fetch_test.go index 5e4e3fc..521a09c 100644 --- a/node/expr/t_static_property_fetch_test.go +++ b/node/expr/t_static_property_fetch_test.go @@ -31,10 +31,14 @@ func TestStaticPropertyFetch(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) - actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php") + php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php") + php5parser.Parse() + actual = php5parser.GetRootNode() assertEqual(t, expected, actual) } @@ -56,10 +60,14 @@ func TestStaticPropertyFetchRelative(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) - actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php") + php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php") + php5parser.Parse() + actual = php5parser.GetRootNode() assertEqual(t, expected, actual) } @@ -81,9 +89,13 @@ func TestStaticPropertyFetchFullyQualified(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) - actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php") + php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php") + php5parser.Parse() + actual = php5parser.GetRootNode() assertEqual(t, expected, actual) } diff --git a/node/expr/t_ternary_test.go b/node/expr/t_ternary_test.go index 5194372..ca6462e 100644 --- a/node/expr/t_ternary_test.go +++ b/node/expr/t_ternary_test.go @@ -27,10 +27,14 @@ func TestTernary(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) - actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php") + php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php") + php5parser.Parse() + actual = php5parser.GetRootNode() assertEqual(t, expected, actual) } @@ -48,10 +52,14 @@ func TestTernarySimple(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) - actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php") + php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php") + php5parser.Parse() + actual = php5parser.GetRootNode() assertEqual(t, expected, actual) } @@ -74,10 +82,14 @@ func TestTernaryNestedTrue(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) - actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php") + php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php") + php5parser.Parse() + actual = php5parser.GetRootNode() assertEqual(t, expected, actual) } @@ -100,9 +112,13 @@ func TestTernaryNestedCond(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) - actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php") + php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php") + php5parser.Parse() + actual = php5parser.GetRootNode() assertEqual(t, expected, actual) } diff --git a/node/expr/t_unary_test.go b/node/expr/t_unary_test.go index d38faec..bac3f10 100644 --- a/node/expr/t_unary_test.go +++ b/node/expr/t_unary_test.go @@ -25,10 +25,14 @@ func TestUnaryMinus(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) - actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php") + php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php") + php5parser.Parse() + actual = php5parser.GetRootNode() assertEqual(t, expected, actual) } @@ -45,9 +49,13 @@ func TestUnaryPlus(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) - actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php") + php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php") + php5parser.Parse() + actual = php5parser.GetRootNode() assertEqual(t, expected, actual) } diff --git a/node/expr/t_variable_test.go b/node/expr/t_variable_test.go index b982f46..8f5a10c 100644 --- a/node/expr/t_variable_test.go +++ b/node/expr/t_variable_test.go @@ -23,10 +23,14 @@ func TestVariable(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) - actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php") + php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php") + php5parser.Parse() + actual = php5parser.GetRootNode() assertEqual(t, expected, actual) } @@ -41,9 +45,13 @@ func TestVariableVariable(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) - actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php") + php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php") + php5parser.Parse() + actual = php5parser.GetRootNode() assertEqual(t, expected, actual) } diff --git a/node/expr/t_yield_test.go b/node/expr/t_yield_test.go index 524b73c..2515839 100644 --- a/node/expr/t_yield_test.go +++ b/node/expr/t_yield_test.go @@ -24,10 +24,14 @@ func TestYield(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) - actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php") + php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php") + php5parser.Parse() + actual = php5parser.GetRootNode() assertEqual(t, expected, actual) } @@ -44,10 +48,14 @@ func TestYieldVal(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) - actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php") + php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php") + php5parser.Parse() + actual = php5parser.GetRootNode() assertEqual(t, expected, actual) } @@ -65,10 +73,14 @@ func TestYieldKeyVal(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) - actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php") + php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php") + php5parser.Parse() + actual = php5parser.GetRootNode() assertEqual(t, expected, actual) } @@ -85,10 +97,14 @@ func TestYieldExpr(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) - actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php") + php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php") + php5parser.Parse() + actual = php5parser.GetRootNode() assertEqual(t, expected, actual) } @@ -106,10 +122,14 @@ func TestYieldKeyExpr(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) - actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php") + php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php") + php5parser.Parse() + actual = php5parser.GetRootNode() assertEqual(t, expected, actual) } @@ -126,6 +146,8 @@ func TestYieldFrom(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) } diff --git a/node/name/t_name_test.go b/node/name/t_name_test.go index e188551..7cd1396 100644 --- a/node/name/t_name_test.go +++ b/node/name/t_name_test.go @@ -44,10 +44,14 @@ func TestName(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) - actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php") + php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php") + php5parser.Parse() + actual = php5parser.GetRootNode() assertEqual(t, expected, actual) } @@ -67,10 +71,14 @@ func TestFullyQualified(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) - actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php") + php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php") + php5parser.Parse() + actual = php5parser.GetRootNode() assertEqual(t, expected, actual) } @@ -90,10 +98,14 @@ func TestRelative(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) - actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php") + php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php") + php5parser.Parse() + actual = php5parser.GetRootNode() assertEqual(t, expected, actual) } diff --git a/node/scalar/t_encapsed_test.go b/node/scalar/t_encapsed_test.go index 860b0ab..2e13d96 100644 --- a/node/scalar/t_encapsed_test.go +++ b/node/scalar/t_encapsed_test.go @@ -29,10 +29,14 @@ func TestSimpleVar(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) - actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php") + php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php") + php5parser.Parse() + actual = php5parser.GetRootNode() assertEqual(t, expected, actual) } @@ -52,10 +56,14 @@ func TestSimpleVarOneChar(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) - actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php") + php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php") + php5parser.Parse() + actual = php5parser.GetRootNode() assertEqual(t, expected, actual) } @@ -76,10 +84,14 @@ func TestSimpleVarEndsEcapsed(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) - actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php") + php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php") + php5parser.Parse() + actual = php5parser.GetRootNode() assertEqual(t, expected, actual) } @@ -100,10 +112,14 @@ func TestStringVarCurveOpen(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) - actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php") + php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php") + php5parser.Parse() + actual = php5parser.GetRootNode() assertEqual(t, expected, actual) } @@ -127,10 +143,14 @@ func TestSimpleVarPropertyFetch(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) - actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php") + php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php") + php5parser.Parse() + actual = php5parser.GetRootNode() assertEqual(t, expected, actual) } @@ -150,10 +170,14 @@ func TestDollarOpenCurlyBraces(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) - actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php") + php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php") + php5parser.Parse() + actual = php5parser.GetRootNode() assertEqual(t, expected, actual) } @@ -176,10 +200,14 @@ func TestDollarOpenCurlyBracesDimNumber(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) - actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php") + php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php") + php5parser.Parse() + actual = php5parser.GetRootNode() assertEqual(t, expected, actual) } @@ -203,9 +231,13 @@ func TestCurlyOpenMethodCall(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) - actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php") + php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php") + php5parser.Parse() + actual = php5parser.GetRootNode() assertEqual(t, expected, actual) } diff --git a/node/scalar/t_heredoc_test.go b/node/scalar/t_heredoc_test.go index 95a64c2..754195f 100644 --- a/node/scalar/t_heredoc_test.go +++ b/node/scalar/t_heredoc_test.go @@ -34,10 +34,14 @@ LBL; }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) - actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php") + php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php") + php5parser.Parse() + actual = php5parser.GetRootNode() assertEqual(t, expected, actual) } @@ -62,10 +66,14 @@ LBL; }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) - actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php") + php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php") + php5parser.Parse() + actual = php5parser.GetRootNode() assertEqual(t, expected, actual) } @@ -88,10 +96,14 @@ LBL; }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) - actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php") + php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php") + php5parser.Parse() + actual = php5parser.GetRootNode() assertEqual(t, expected, actual) } @@ -110,10 +122,14 @@ CAD; }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) - actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php") + php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php") + php5parser.Parse() + actual = php5parser.GetRootNode() assertEqual(t, expected, actual) } @@ -136,9 +152,13 @@ CAD; }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) - actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php") + php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php") + php5parser.Parse() + actual = php5parser.GetRootNode() assertEqual(t, expected, actual) } diff --git a/node/scalar/t_magic_constant_test.go b/node/scalar/t_magic_constant_test.go index 77f9863..9b8d2f1 100644 --- a/node/scalar/t_magic_constant_test.go +++ b/node/scalar/t_magic_constant_test.go @@ -23,9 +23,13 @@ func TestMagicConstant(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) - actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php") + php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php") + php5parser.Parse() + actual = php5parser.GetRootNode() assertEqual(t, expected, actual) } diff --git a/node/scalar/t_numbers_test.go b/node/scalar/t_numbers_test.go index 73b4de5..fa04eb5 100644 --- a/node/scalar/t_numbers_test.go +++ b/node/scalar/t_numbers_test.go @@ -37,10 +37,14 @@ func TestLNumber(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) - actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php") + php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php") + php5parser.Parse() + actual = php5parser.GetRootNode() assertEqual(t, expected, actual) } @@ -55,10 +59,14 @@ func TestDNumber(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) - actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php") + php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php") + php5parser.Parse() + actual = php5parser.GetRootNode() assertEqual(t, expected, actual) } @@ -73,10 +81,14 @@ func TestFloat(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) - actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php") + php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php") + php5parser.Parse() + actual = php5parser.GetRootNode() assertEqual(t, expected, actual) } @@ -91,10 +103,14 @@ func TestBinaryLNumber(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) - actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php") + php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php") + php5parser.Parse() + actual = php5parser.GetRootNode() assertEqual(t, expected, actual) } @@ -109,10 +125,14 @@ func TestBinaryDNumber(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) - actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php") + php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php") + php5parser.Parse() + actual = php5parser.GetRootNode() assertEqual(t, expected, actual) } @@ -127,10 +147,14 @@ func TestHLNumber(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) - actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php") + php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php") + php5parser.Parse() + actual = php5parser.GetRootNode() assertEqual(t, expected, actual) } @@ -145,9 +169,13 @@ func TestHDNumber(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) - actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php") + php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php") + php5parser.Parse() + actual = php5parser.GetRootNode() assertEqual(t, expected, actual) } diff --git a/node/scalar/t_string_test.go b/node/scalar/t_string_test.go index 1dbc055..fc344fd 100644 --- a/node/scalar/t_string_test.go +++ b/node/scalar/t_string_test.go @@ -22,10 +22,14 @@ func TestDoubleQuotedScalarString(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) - actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php") + php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php") + php5parser.Parse() + actual = php5parser.GetRootNode() assertEqual(t, expected, actual) } func TestDoubleQuotedScalarStringWithEscapedVar(t *testing.T) { @@ -39,10 +43,14 @@ func TestDoubleQuotedScalarStringWithEscapedVar(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) - actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php") + php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php") + php5parser.Parse() + actual = php5parser.GetRootNode() assertEqual(t, expected, actual) } @@ -59,10 +67,14 @@ func TestMultilineDoubleQuotedScalarString(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) - actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php") + php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php") + php5parser.Parse() + actual = php5parser.GetRootNode() assertEqual(t, expected, actual) } @@ -77,10 +89,14 @@ func TestSingleQuotedScalarString(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) - actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php") + php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php") + php5parser.Parse() + actual = php5parser.GetRootNode() assertEqual(t, expected, actual) } @@ -97,9 +113,13 @@ func TestMultilineSingleQuotedScalarString(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) - actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php") + php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php") + php5parser.Parse() + actual = php5parser.GetRootNode() assertEqual(t, expected, actual) } diff --git a/node/stmt/t_alt_if_test.go b/node/stmt/t_alt_if_test.go index 7dcb4a8..702820f 100644 --- a/node/stmt/t_alt_if_test.go +++ b/node/stmt/t_alt_if_test.go @@ -42,10 +42,14 @@ func TestAltIf(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) - actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php") + php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php") + php5parser.Parse() + actual = php5parser.GetRootNode() assertEqual(t, expected, actual) } @@ -71,10 +75,14 @@ func TestAltElseIf(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) - actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php") + php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php") + php5parser.Parse() + actual = php5parser.GetRootNode() assertEqual(t, expected, actual) } @@ -97,10 +105,14 @@ func TestAltElse(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) - actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php") + php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php") + php5parser.Parse() + actual = php5parser.GetRootNode() assertEqual(t, expected, actual) } @@ -135,9 +147,13 @@ func TestAltElseElseIf(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) - actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php") + php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php") + php5parser.Parse() + actual = php5parser.GetRootNode() assertEqual(t, expected, actual) } diff --git a/node/stmt/t_class_const_list_test.go b/node/stmt/t_class_const_list_test.go index 5582f7c..7b09a84 100644 --- a/node/stmt/t_class_const_list_test.go +++ b/node/stmt/t_class_const_list_test.go @@ -42,7 +42,9 @@ func TestClassConstList(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) } @@ -73,9 +75,13 @@ func TestClassConstListWithoutModifiers(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) - actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php") + php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php") + php5parser.Parse() + actual = php5parser.GetRootNode() assertEqual(t, expected, actual) } diff --git a/node/stmt/t_class_method_test.go b/node/stmt/t_class_method_test.go index 1a366e0..d842575 100644 --- a/node/stmt/t_class_method_test.go +++ b/node/stmt/t_class_method_test.go @@ -29,10 +29,14 @@ func TestSimpleClassMethod(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) - actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php") + php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php") + php5parser.Parse() + actual = php5parser.GetRootNode() assertEqual(t, expected, actual) } @@ -68,10 +72,14 @@ func TestPrivateProtectedClassMethod(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) - actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php") + php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php") + php5parser.Parse() + actual = php5parser.GetRootNode() assertEqual(t, expected, actual) } @@ -98,7 +106,9 @@ func TestPhp5ClassMethod(t *testing.T) { }, } - actual, _, _, _ := php5.Parse(bytes.NewBufferString(src), "test.php") + php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php") + php5parser.Parse() + actual := php5parser.GetRootNode() assertEqual(t, expected, actual) } @@ -130,7 +140,9 @@ func TestPhp7ClassMethod(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) } @@ -157,10 +169,14 @@ func TestAbstractClassMethod(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) - actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php") + php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php") + php5parser.Parse() + actual = php5parser.GetRootNode() assertEqual(t, expected, actual) } @@ -191,6 +207,8 @@ func TestPhp7AbstractClassMethod(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) } diff --git a/node/stmt/t_class_test.go b/node/stmt/t_class_test.go index df747b8..c3c6d31 100644 --- a/node/stmt/t_class_test.go +++ b/node/stmt/t_class_test.go @@ -24,10 +24,14 @@ func TestSimpleClass(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) - actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php") + php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php") + php5parser.Parse() + actual = php5parser.GetRootNode() assertEqual(t, expected, actual) } @@ -46,10 +50,14 @@ func TestAbstractClass(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) - actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php") + php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php") + php5parser.Parse() + actual = php5parser.GetRootNode() assertEqual(t, expected, actual) } @@ -73,10 +81,14 @@ func TestClassExtends(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) - actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php") + php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php") + php5parser.Parse() + actual = php5parser.GetRootNode() assertEqual(t, expected, actual) } @@ -102,10 +114,14 @@ func TestClassImplement(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) - actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php") + php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php") + php5parser.Parse() + actual = php5parser.GetRootNode() assertEqual(t, expected, actual) } @@ -136,10 +152,14 @@ func TestClassImplements(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) - actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php") + php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php") + php5parser.Parse() + actual = php5parser.GetRootNode() assertEqual(t, expected, actual) } @@ -176,6 +196,8 @@ func TestAnonimousClass(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) } diff --git a/node/stmt/t_const_list_test.go b/node/stmt/t_const_list_test.go index 50a8562..0de3f14 100644 --- a/node/stmt/t_const_list_test.go +++ b/node/stmt/t_const_list_test.go @@ -34,9 +34,13 @@ func TestConstList(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) - actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php") + php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php") + php5parser.Parse() + actual = php5parser.GetRootNode() assertEqual(t, expected, actual) } diff --git a/node/stmt/t_continue_test.go b/node/stmt/t_continue_test.go index 73ae4dc..66b8c5f 100644 --- a/node/stmt/t_continue_test.go +++ b/node/stmt/t_continue_test.go @@ -28,10 +28,14 @@ func TestContinueEmpty(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) - actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php") + php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php") + php5parser.Parse() + actual = php5parser.GetRootNode() assertEqual(t, expected, actual) } @@ -53,10 +57,14 @@ func TestContinueLight(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) - actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php") + php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php") + php5parser.Parse() + actual = php5parser.GetRootNode() assertEqual(t, expected, actual) } @@ -78,9 +86,13 @@ func TestContinue(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) - actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php") + php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php") + php5parser.Parse() + actual = php5parser.GetRootNode() assertEqual(t, expected, actual) } diff --git a/node/stmt/t_declare_test.go b/node/stmt/t_declare_test.go index 5de7b51..fbbf002 100644 --- a/node/stmt/t_declare_test.go +++ b/node/stmt/t_declare_test.go @@ -30,10 +30,14 @@ func TestDeclare(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) - actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php") + php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php") + php5parser.Parse() + actual = php5parser.GetRootNode() assertEqual(t, expected, actual) } @@ -62,10 +66,14 @@ func TestDeclareStmts(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) - actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php") + php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php") + php5parser.Parse() + actual = php5parser.GetRootNode() assertEqual(t, expected, actual) } @@ -89,9 +97,13 @@ func TestAltDeclare(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) - actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php") + php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php") + php5parser.Parse() + actual = php5parser.GetRootNode() assertEqual(t, expected, actual) } diff --git a/node/stmt/t_do_test.go b/node/stmt/t_do_test.go index 03ae6ad..d508c18 100644 --- a/node/stmt/t_do_test.go +++ b/node/stmt/t_do_test.go @@ -26,9 +26,13 @@ func TestDo(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) - actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php") + php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php") + php5parser.Parse() + actual = php5parser.GetRootNode() assertEqual(t, expected, actual) } diff --git a/node/stmt/t_echo_test.go b/node/stmt/t_echo_test.go index 26cef38..f2e6ebc 100644 --- a/node/stmt/t_echo_test.go +++ b/node/stmt/t_echo_test.go @@ -30,10 +30,14 @@ func TestSimpleEcho(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) - actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php") + php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php") + php5parser.Parse() + actual = php5parser.GetRootNode() assertEqual(t, expected, actual) } @@ -52,9 +56,13 @@ func TestEcho(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) - actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php") + php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php") + php5parser.Parse() + actual = php5parser.GetRootNode() assertEqual(t, expected, actual) } diff --git a/node/stmt/t_expression_test.go b/node/stmt/t_expression_test.go index 8138fee..7c485ef 100644 --- a/node/stmt/t_expression_test.go +++ b/node/stmt/t_expression_test.go @@ -23,9 +23,13 @@ func TestExpression(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) - actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php") + php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php") + php5parser.Parse() + actual = php5parser.GetRootNode() assertEqual(t, expected, actual) } diff --git a/node/stmt/t_for_test.go b/node/stmt/t_for_test.go index b221fd5..83be83e 100644 --- a/node/stmt/t_for_test.go +++ b/node/stmt/t_for_test.go @@ -48,10 +48,14 @@ func TestFor(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) - actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php") + php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php") + php5parser.Parse() + actual = php5parser.GetRootNode() assertEqual(t, expected, actual) } @@ -77,9 +81,13 @@ func TestAltFor(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) - actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php") + php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php") + php5parser.Parse() + actual = php5parser.GetRootNode() assertEqual(t, expected, actual) } diff --git a/node/stmt/t_foreach_test.go b/node/stmt/t_foreach_test.go index f92ac84..8f7f7cc 100644 --- a/node/stmt/t_foreach_test.go +++ b/node/stmt/t_foreach_test.go @@ -25,10 +25,14 @@ func TestForeach(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) - actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php") + php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php") + php5parser.Parse() + actual = php5parser.GetRootNode() assertEqual(t, expected, actual) } @@ -45,10 +49,14 @@ func TestForeachExpr(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) - actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php") + php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php") + php5parser.Parse() + actual = php5parser.GetRootNode() assertEqual(t, expected, actual) } @@ -65,10 +73,14 @@ func TestAltForeach(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) - actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php") + php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php") + php5parser.Parse() + actual = php5parser.GetRootNode() assertEqual(t, expected, actual) } @@ -86,10 +98,14 @@ func TestForeachWithKey(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) - actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php") + php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php") + php5parser.Parse() + actual = php5parser.GetRootNode() assertEqual(t, expected, actual) } @@ -107,10 +123,14 @@ func TestForeachExprWithKey(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) - actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php") + php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php") + php5parser.Parse() + actual = php5parser.GetRootNode() assertEqual(t, expected, actual) } @@ -129,10 +149,14 @@ func TestForeachWithRef(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) - actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php") + php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php") + php5parser.Parse() + actual = php5parser.GetRootNode() assertEqual(t, expected, actual) } @@ -158,9 +182,13 @@ func TestForeachWithList(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) - actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php") + php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php") + php5parser.Parse() + actual = php5parser.GetRootNode() assertEqual(t, expected, actual) } diff --git a/node/stmt/t_function_test.go b/node/stmt/t_function_test.go index fc5c004..92cf463 100644 --- a/node/stmt/t_function_test.go +++ b/node/stmt/t_function_test.go @@ -28,10 +28,14 @@ func TestSimpleFunction(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) - actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php") + php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php") + php5parser.Parse() + actual = php5parser.GetRootNode() assertEqual(t, expected, actual) } @@ -51,10 +55,14 @@ func TestFunctionReturn(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) - actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php") + php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php") + php5parser.Parse() + actual = php5parser.GetRootNode() assertEqual(t, expected, actual) } @@ -90,10 +98,14 @@ func TestFunctionReturnVar(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) - actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php") + php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php") + php5parser.Parse() + actual = php5parser.GetRootNode() assertEqual(t, expected, actual) } @@ -115,10 +127,14 @@ func TestRefFunction(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) - actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php") + php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php") + php5parser.Parse() + actual = php5parser.GetRootNode() assertEqual(t, expected, actual) } @@ -141,6 +157,8 @@ func TestReturnTypeFunction(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) } diff --git a/node/stmt/t_global_test.go b/node/stmt/t_global_test.go index e07227f..7d72898 100644 --- a/node/stmt/t_global_test.go +++ b/node/stmt/t_global_test.go @@ -25,10 +25,14 @@ func TestGlobal(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) - actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php") + php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php") + php5parser.Parse() + actual = php5parser.GetRootNode() assertEqual(t, expected, actual) } @@ -57,9 +61,13 @@ func TestGlobalVars(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) - actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php") + php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php") + php5parser.Parse() + actual = php5parser.GetRootNode() assertEqual(t, expected, actual) } diff --git a/node/stmt/t_goto_label_test.go b/node/stmt/t_goto_label_test.go index 57872e8..51977b1 100644 --- a/node/stmt/t_goto_label_test.go +++ b/node/stmt/t_goto_label_test.go @@ -24,9 +24,13 @@ func TestGotoLabel(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) - actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php") + php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php") + php5parser.Parse() + actual = php5parser.GetRootNode() assertEqual(t, expected, actual) } diff --git a/node/stmt/t_halt_compiler_test.go b/node/stmt/t_halt_compiler_test.go index a88b956..420e4ba 100644 --- a/node/stmt/t_halt_compiler_test.go +++ b/node/stmt/t_halt_compiler_test.go @@ -19,9 +19,13 @@ func TestHaltCompiler(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) - actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php") + php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php") + php5parser.Parse() + actual = php5parser.GetRootNode() assertEqual(t, expected, actual) } diff --git a/node/stmt/t_if_test.go b/node/stmt/t_if_test.go index 67bf33c..8270077 100644 --- a/node/stmt/t_if_test.go +++ b/node/stmt/t_if_test.go @@ -24,10 +24,14 @@ func TestIf(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) - actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php") + php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php") + php5parser.Parse() + actual = php5parser.GetRootNode() assertEqual(t, expected, actual) } @@ -50,10 +54,14 @@ func TestElseIf(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) - actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php") + php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php") + php5parser.Parse() + actual = php5parser.GetRootNode() assertEqual(t, expected, actual) } @@ -72,10 +80,14 @@ func TestElse(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) - actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php") + php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php") + php5parser.Parse() + actual = php5parser.GetRootNode() assertEqual(t, expected, actual) } @@ -104,10 +116,14 @@ func TestElseElseIf(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) - actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php") + php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php") + php5parser.Parse() + actual = php5parser.GetRootNode() assertEqual(t, expected, actual) } @@ -138,9 +154,13 @@ func TestElseIfElseIfElse(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) - actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php") + php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php") + php5parser.Parse() + actual = php5parser.GetRootNode() assertEqual(t, expected, actual) } diff --git a/node/stmt/t_inline_html_test.go b/node/stmt/t_inline_html_test.go index 04a4da6..f7650ce 100644 --- a/node/stmt/t_inline_html_test.go +++ b/node/stmt/t_inline_html_test.go @@ -20,9 +20,13 @@ func TestInlineHtml(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) - actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php") + php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php") + php5parser.Parse() + actual = php5parser.GetRootNode() assertEqual(t, expected, actual) } diff --git a/node/stmt/t_interface_test.go b/node/stmt/t_interface_test.go index 26cb47f..78f1e8e 100644 --- a/node/stmt/t_interface_test.go +++ b/node/stmt/t_interface_test.go @@ -24,10 +24,14 @@ func TestInterface(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) - actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php") + php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php") + php5parser.Parse() + actual = php5parser.GetRootNode() assertEqual(t, expected, actual) } @@ -51,10 +55,14 @@ func TestInterfaceExtend(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) - actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php") + php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php") + php5parser.Parse() + actual = php5parser.GetRootNode() assertEqual(t, expected, actual) } @@ -83,9 +91,13 @@ func TestInterfaceExtends(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) - actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php") + php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php") + php5parser.Parse() + actual = php5parser.GetRootNode() assertEqual(t, expected, actual) } diff --git a/node/stmt/t_namespace_test.go b/node/stmt/t_namespace_test.go index 2d6e5b7..2c4cf33 100644 --- a/node/stmt/t_namespace_test.go +++ b/node/stmt/t_namespace_test.go @@ -26,10 +26,14 @@ func TestNamespace(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) - actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php") + php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php") + php5parser.Parse() + actual = php5parser.GetRootNode() assertEqual(t, expected, actual) } @@ -49,10 +53,14 @@ func TestNamespaceStmts(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) - actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php") + php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php") + php5parser.Parse() + actual = php5parser.GetRootNode() assertEqual(t, expected, actual) } @@ -67,9 +75,13 @@ func TestAnonymousNamespace(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) - actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php") + php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php") + php5parser.Parse() + actual = php5parser.GetRootNode() assertEqual(t, expected, actual) } diff --git a/node/stmt/t_property_list_test.go b/node/stmt/t_property_list_test.go index 3e646e8..5d25f61 100644 --- a/node/stmt/t_property_list_test.go +++ b/node/stmt/t_property_list_test.go @@ -36,10 +36,14 @@ func TestProperty(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) - actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php") + php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php") + php5parser.Parse() + actual = php5parser.GetRootNode() assertEqual(t, expected, actual) } @@ -73,10 +77,14 @@ func TestProperties(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) - actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php") + php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php") + php5parser.Parse() + actual = php5parser.GetRootNode() assertEqual(t, expected, actual) } @@ -110,9 +118,13 @@ func TestProperties2(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) - actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php") + php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php") + php5parser.Parse() + actual = php5parser.GetRootNode() assertEqual(t, expected, actual) } diff --git a/node/stmt/t_static_var_test.go b/node/stmt/t_static_var_test.go index 8765e51..668b6cd 100644 --- a/node/stmt/t_static_var_test.go +++ b/node/stmt/t_static_var_test.go @@ -27,10 +27,14 @@ func TestStaticVar(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) - actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php") + php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php") + php5parser.Parse() + actual = php5parser.GetRootNode() assertEqual(t, expected, actual) } @@ -53,10 +57,14 @@ func TestStaticVars(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) - actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php") + php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php") + php5parser.Parse() + actual = php5parser.GetRootNode() assertEqual(t, expected, actual) } @@ -79,9 +87,13 @@ func TestStaticVars2(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) - actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php") + php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php") + php5parser.Parse() + actual = php5parser.GetRootNode() assertEqual(t, expected, actual) } diff --git a/node/stmt/t_switch_case_default_test.go b/node/stmt/t_switch_case_default_test.go index 82da70a..d227694 100644 --- a/node/stmt/t_switch_case_default_test.go +++ b/node/stmt/t_switch_case_default_test.go @@ -42,10 +42,14 @@ func TestAltSwitch(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) - actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php") + php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php") + php5parser.Parse() + actual = php5parser.GetRootNode() assertEqual(t, expected, actual) } @@ -75,10 +79,14 @@ func TestAltSwitchSemicolon(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) - actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php") + php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php") + php5parser.Parse() + actual = php5parser.GetRootNode() assertEqual(t, expected, actual) } @@ -112,10 +120,14 @@ func TestSwitch(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) - actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php") + php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php") + php5parser.Parse() + actual = php5parser.GetRootNode() assertEqual(t, expected, actual) } @@ -149,9 +161,13 @@ func TestSwitchSemicolon(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) - actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php") + php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php") + php5parser.Parse() + actual = php5parser.GetRootNode() assertEqual(t, expected, actual) } diff --git a/node/stmt/t_throw_test.go b/node/stmt/t_throw_test.go index 40aa851..cfc7be8 100644 --- a/node/stmt/t_throw_test.go +++ b/node/stmt/t_throw_test.go @@ -22,9 +22,13 @@ func TestThrow(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) - actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php") + php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php") + php5parser.Parse() + actual = php5parser.GetRootNode() assertEqual(t, expected, actual) } diff --git a/node/stmt/t_trait_test.go b/node/stmt/t_trait_test.go index 4a6e099..b774dac 100644 --- a/node/stmt/t_trait_test.go +++ b/node/stmt/t_trait_test.go @@ -23,9 +23,13 @@ func TestTrait(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) - actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php") + php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php") + php5parser.Parse() + actual = php5parser.GetRootNode() assertEqual(t, expected, actual) } diff --git a/node/stmt/t_trait_use_test.go b/node/stmt/t_trait_use_test.go index af7804a..e6b3b10 100644 --- a/node/stmt/t_trait_use_test.go +++ b/node/stmt/t_trait_use_test.go @@ -34,10 +34,14 @@ func TestTraitUse(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) - actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php") + php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php") + php5parser.Parse() + actual = php5parser.GetRootNode() assertEqual(t, expected, actual) } @@ -69,10 +73,14 @@ func TestTraitsUse(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) - actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php") + php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php") + php5parser.Parse() + actual = php5parser.GetRootNode() assertEqual(t, expected, actual) } @@ -104,10 +112,14 @@ func TestTraitsUseEmptyAdaptations(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) - actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php") + php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php") + php5parser.Parse() + actual = php5parser.GetRootNode() assertEqual(t, expected, actual) } @@ -147,10 +159,14 @@ func TestTraitsUseModifier(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) - actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php") + php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php") + php5parser.Parse() + actual = php5parser.GetRootNode() assertEqual(t, expected, actual) } @@ -191,10 +207,14 @@ func TestTraitsUseAliasModifier(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) - actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php") + php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php") + php5parser.Parse() + actual = php5parser.GetRootNode() assertEqual(t, expected, actual) } @@ -261,9 +281,13 @@ func TestTraitsUseAdaptions(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) - actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php") + php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php") + php5parser.Parse() + actual = php5parser.GetRootNode() assertEqual(t, expected, actual) } diff --git a/node/stmt/t_try_catch_finnaly_test.go b/node/stmt/t_try_catch_finnaly_test.go index 0c8da51..4fbcda4 100644 --- a/node/stmt/t_try_catch_finnaly_test.go +++ b/node/stmt/t_try_catch_finnaly_test.go @@ -26,10 +26,14 @@ func TestTry(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) - actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php") + php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php") + php5parser.Parse() + actual = php5parser.GetRootNode() assertEqual(t, expected, actual) } @@ -61,10 +65,14 @@ func TestTryCatch(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) - actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php") + php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php") + php5parser.Parse() + actual = php5parser.GetRootNode() assertEqual(t, expected, actual) } @@ -101,7 +109,9 @@ func TestPhp7TryCatch(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) } @@ -146,10 +156,14 @@ func TestTryCatchCatch(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) - actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php") + php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php") + php5parser.Parse() + actual = php5parser.GetRootNode() assertEqual(t, expected, actual) } @@ -184,10 +198,14 @@ func TestTryCatchFinally(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) - actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php") + php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php") + php5parser.Parse() + actual = php5parser.GetRootNode() assertEqual(t, expected, actual) } @@ -243,9 +261,13 @@ func TestTryCatchCatchCatch(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) - actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php") + php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php") + php5parser.Parse() + actual = php5parser.GetRootNode() assertEqual(t, expected, actual) } diff --git a/node/stmt/t_unset_test.go b/node/stmt/t_unset_test.go index 1073d51..8b6f32a 100644 --- a/node/stmt/t_unset_test.go +++ b/node/stmt/t_unset_test.go @@ -24,10 +24,14 @@ func TestUnset(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) - actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php") + php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php") + php5parser.Parse() + actual = php5parser.GetRootNode() assertEqual(t, expected, actual) } @@ -45,10 +49,14 @@ func TestUnsetVars(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) - actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php") + php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php") + php5parser.Parse() + actual = php5parser.GetRootNode() assertEqual(t, expected, actual) } @@ -66,6 +74,8 @@ func TestUnsetTrailingComma(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) } diff --git a/node/stmt/t_use_test.go b/node/stmt/t_use_test.go index a92057a..86d4a45 100644 --- a/node/stmt/t_use_test.go +++ b/node/stmt/t_use_test.go @@ -30,10 +30,14 @@ func TestSimpleUse(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) - actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php") + php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php") + php5parser.Parse() + actual = php5parser.GetRootNode() assertEqual(t, expected, actual) } @@ -56,10 +60,14 @@ func TestUseFullyQualified(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) - actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php") + php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php") + php5parser.Parse() + actual = php5parser.GetRootNode() assertEqual(t, expected, actual) } @@ -83,10 +91,14 @@ func TestUseFullyQualifiedAlias(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) - actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php") + php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php") + php5parser.Parse() + actual = php5parser.GetRootNode() assertEqual(t, expected, actual) } @@ -116,10 +128,14 @@ func TestUseList(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) - actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php") + php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php") + php5parser.Parse() + actual = php5parser.GetRootNode() assertEqual(t, expected, actual) } @@ -150,10 +166,14 @@ func TestUseListAlias(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) - actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php") + php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php") + php5parser.Parse() + actual = php5parser.GetRootNode() assertEqual(t, expected, actual) } @@ -184,10 +204,14 @@ func TestUseListFunctionType(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) - actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php") + php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php") + php5parser.Parse() + actual = php5parser.GetRootNode() assertEqual(t, expected, actual) } @@ -220,10 +244,14 @@ func TestUseListFunctionTypeAliases(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) - actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php") + php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php") + php5parser.Parse() + actual = php5parser.GetRootNode() assertEqual(t, expected, actual) } @@ -254,10 +282,14 @@ func TestUseListConstType(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) - actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php") + php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php") + php5parser.Parse() + actual = php5parser.GetRootNode() assertEqual(t, expected, actual) } @@ -290,10 +322,14 @@ func TestUseListConstTypeAliases(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) - actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php") + php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php") + php5parser.Parse() + actual = php5parser.GetRootNode() assertEqual(t, expected, actual) } @@ -328,7 +364,9 @@ func TestGroupUse(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) } @@ -364,7 +402,9 @@ func TestGroupUseAlias(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) } @@ -400,7 +440,9 @@ func TestFunctionGroupUse(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) } @@ -436,7 +478,9 @@ func TestConstGroupUse(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) } @@ -473,6 +517,8 @@ func TestMixedGroupUse(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) } diff --git a/node/stmt/t_while_break_test.go b/node/stmt/t_while_break_test.go index dbba5d6..61fe5f2 100644 --- a/node/stmt/t_while_break_test.go +++ b/node/stmt/t_while_break_test.go @@ -28,10 +28,14 @@ func TestBreakEmpty(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) - actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php") + php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php") + php5parser.Parse() + actual = php5parser.GetRootNode() assertEqual(t, expected, actual) } @@ -53,10 +57,14 @@ func TestBreakLight(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) - actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php") + php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php") + php5parser.Parse() + actual = php5parser.GetRootNode() assertEqual(t, expected, actual) } @@ -78,9 +86,13 @@ func TestBreak(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) - actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php") + php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php") + php5parser.Parse() + actual = php5parser.GetRootNode() assertEqual(t, expected, actual) } diff --git a/node/t_node_test.go b/node/t_node_test.go index fb44a09..b7dc2c0 100644 --- a/node/t_node_test.go +++ b/node/t_node_test.go @@ -42,10 +42,14 @@ func TestIdentifier(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) - actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php") + php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php") + php5parser.Parse() + actual = php5parser.GetRootNode() assertEqual(t, expected, actual) } @@ -135,7 +139,9 @@ func TestPhp7ArgumentNode(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) } @@ -211,7 +217,9 @@ func TestPhp5ArgumentNode(t *testing.T) { }, } - actual, _, _, _ := php5.Parse(bytes.NewBufferString(src), "test.php") + php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php") + php5parser.Parse() + actual := php5parser.GetRootNode() assertEqual(t, expected, actual) } @@ -277,7 +285,9 @@ func TestPhp7ParameterNode(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) } @@ -343,7 +353,9 @@ func TestPhp5ParameterNode(t *testing.T) { }, } - actual, _, _, _ := php5.Parse(bytes.NewBufferString(src), "test.php") + php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php") + php5parser.Parse() + actual := php5parser.GetRootNode() assertEqual(t, expected, actual) } @@ -354,9 +366,13 @@ func TestCommentEndFile(t *testing.T) { Stmts: []node.Node{}, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) - actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php") + php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php") + php5parser.Parse() + actual = php5parser.GetRootNode() assertEqual(t, expected, actual) } diff --git a/php5/php5_bench_test.go b/php5/php5_bench_test.go index 3573542..a5418f2 100644 --- a/php5/php5_bench_test.go +++ b/php5/php5_bench_test.go @@ -414,6 +414,7 @@ CAD; ` for n := 0; n < b.N; n++ { - php5.Parse(bytes.NewBufferString(src), "test.php") + php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php") + php5parser.Parse() } } diff --git a/php5/php5_test.go b/php5/php5_test.go index e3ebe84..4dccea5 100644 --- a/php5/php5_test.go +++ b/php5/php5_test.go @@ -3615,7 +3615,9 @@ func TestPhp5(t *testing.T) { }, } - actual, _, _, _ := php5.Parse(bytes.NewBufferString(src), "test.php") + php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php") + php5parser.Parse() + actual := php5parser.GetRootNode() assertEqual(t, expected, actual) } @@ -3652,7 +3654,9 @@ func TestPhp5Strings(t *testing.T) { }, } - actual, _, _, _ := php5.Parse(bytes.NewBufferString(src), "test.php") + php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php") + php5parser.Parse() + actual := php5parser.GetRootNode() assertEqual(t, expected, actual) } @@ -3718,6 +3722,8 @@ CAD; }, } - actual, _, _, _ := php5.Parse(bytes.NewBufferString(src), "test.php") + php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php") + php5parser.Parse() + actual := php5parser.GetRootNode() assertEqual(t, expected, actual) } diff --git a/php7/php7_bench_test.go b/php7/php7_bench_test.go index 3c1e7d5..8cee251 100644 --- a/php7/php7_bench_test.go +++ b/php7/php7_bench_test.go @@ -382,6 +382,7 @@ CAD; ` for n := 0; n < b.N; n++ { - php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() } } diff --git a/php7/php7_test.go b/php7/php7_test.go index cdb3061..3b3c49c 100644 --- a/php7/php7_test.go +++ b/php7/php7_test.go @@ -3166,7 +3166,9 @@ func TestPhp7(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) } @@ -3203,7 +3205,9 @@ func TestPhp5Strings(t *testing.T) { }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) } @@ -3269,6 +3273,8 @@ CAD; }, } - actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + actual := php7parser.GetRootNode() assertEqual(t, expected, actual) } diff --git a/visitor/dumper_test.go b/visitor/dumper_test.go index 26ab8b3..11d07f6 100644 --- a/visitor/dumper_test.go +++ b/visitor/dumper_test.go @@ -22,7 +22,9 @@ func ExampleDumper() { } }` - nodes, comments, positions, _ := php7.Parse(bytes.NewBufferString(src), "test.php") + php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") + php7parser.Parse() + nodes := php7parser.GetRootNode() nsResolver := visitor.NewNamespaceResolver() nodes.Walk(nsResolver) @@ -30,8 +32,8 @@ func ExampleDumper() { dumper := visitor.Dumper{ Writer: os.Stdout, Indent: "| ", - Comments: comments, - Positions: positions, + Comments: php7parser.GetComments(), + Positions: php7parser.GetPositions(), NsResolver: nsResolver, } nodes.Walk(dumper)