diff --git a/Makefile b/Makefile index d0545b76..fa6184b4 100644 --- a/Makefile +++ b/Makefile @@ -44,8 +44,8 @@ doc: # http://golang.org/cmd/go/#hdr-Run_gofmt_on_package_sources fmt: - go fmt ${DIR_PKG}/... && \ - goimports -w -local github.com/MontFerret ./pkg ./test/e2e + go fmt ${DIR_PKG}/... ${DIR_INTEG}/... ${DIR_E2E}/... && \ + goimports -w -local github.com/MontFerret ${DIR_PKG} ${DIR_INTEG} ${DIR_E2E} # https://github.com/mgechev/revive # go get github.com/mgechev/revive diff --git a/pkg/compiler/compiler.go b/pkg/compiler/compiler.go index 42ac129f..1a2cdbe1 100644 --- a/pkg/compiler/compiler.go +++ b/pkg/compiler/compiler.go @@ -2,10 +2,9 @@ package compiler import ( "errors" - "github.com/MontFerret/ferret/pkg/compiler/internal/core" goruntime "runtime" - "github.com/MontFerret/ferret/pkg/compiler/internal" + "github.com/MontFerret/ferret/pkg/compiler/internal/core" "github.com/MontFerret/ferret/pkg/stdlib" "github.com/MontFerret/ferret/pkg/vm" @@ -65,7 +64,7 @@ func (c *Compiler) Compile(query string) (program *vm.Program, err error) { p := parser.New(query) p.AddErrorListener(newErrorListener()) - l := internal.NewVisitor(query) + l := NewVisitor(query) p.Visit(l) @@ -74,11 +73,11 @@ func (c *Compiler) Compile(query string) (program *vm.Program, err error) { } program = &vm.Program{} - program.Bytecode = l.Emitter.Bytecode() - program.Constants = l.Symbols.Constants() - program.CatchTable = l.CatchTable.All() - program.Registers = l.Registers.Size() - program.Params = l.Symbols.Params() + program.Bytecode = l.Ctx.Emitter.Bytecode() + program.Constants = l.Ctx.Symbols.Constants() + program.CatchTable = l.Ctx.CatchTable.All() + program.Registers = l.Ctx.Registers.Size() + program.Params = l.Ctx.Symbols.Params() return program, err } diff --git a/pkg/compiler/internal/core/constant_pool.go b/pkg/compiler/internal/core/constant_pool.go index bfac9544..246a462d 100644 --- a/pkg/compiler/internal/core/constant_pool.go +++ b/pkg/compiler/internal/core/constant_pool.go @@ -1,9 +1,10 @@ package core import ( + "strconv" + "github.com/MontFerret/ferret/pkg/runtime" "github.com/MontFerret/ferret/pkg/vm" - "strconv" ) // ConstantPool stores and deduplicates constants diff --git a/pkg/compiler/internal/core/emitter_helpers.go b/pkg/compiler/internal/core/emitter_helpers.go index 9ebba673..cf4c4622 100644 --- a/pkg/compiler/internal/core/emitter_helpers.go +++ b/pkg/compiler/internal/core/emitter_helpers.go @@ -58,8 +58,8 @@ func (e *Emitter) EmitLoadGlobal(dst, constant vm.Operand) { e.EmitAB(vm.OpLoadGlobal, dst, constant) } -func (e *Emitter) EmitLoadParam(constant vm.Operand) { - e.EmitA(vm.OpLoadParam, constant) +func (e *Emitter) EmitLoadParam(dst, constant vm.Operand) { + e.EmitAB(vm.OpLoadParam, dst, constant) } func (e *Emitter) EmitBoolean(dst vm.Operand, value bool) { diff --git a/pkg/compiler/internal/core/symbol_table.go b/pkg/compiler/internal/core/symbol_table.go index 31416979..6146918b 100644 --- a/pkg/compiler/internal/core/symbol_table.go +++ b/pkg/compiler/internal/core/symbol_table.go @@ -2,6 +2,7 @@ package core import ( "fmt" + "github.com/MontFerret/ferret/pkg/runtime" "github.com/MontFerret/ferret/pkg/vm" ) diff --git a/pkg/compiler/internal/expr_compiler.go b/pkg/compiler/internal/expr.go similarity index 99% rename from pkg/compiler/internal/expr_compiler.go rename to pkg/compiler/internal/expr.go index d828b31b..d80bfda7 100644 --- a/pkg/compiler/internal/expr_compiler.go +++ b/pkg/compiler/internal/expr.go @@ -1,12 +1,13 @@ package internal import ( + "regexp" + "strings" + "github.com/MontFerret/ferret/pkg/compiler/internal/core" "github.com/MontFerret/ferret/pkg/parser/fql" "github.com/MontFerret/ferret/pkg/runtime" "github.com/MontFerret/ferret/pkg/vm" - "regexp" - "strings" ) // Runtime functions @@ -370,8 +371,8 @@ func (ec *ExprCompiler) CompileVariable(ctx fql.IVariableContext) vm.Operand { func (ec *ExprCompiler) CompileParam(ctx fql.IParamContext) vm.Operand { name := ctx.Identifier().GetText() - reg := ec.ctx.Symbols.BindParam(name) - ec.ctx.Emitter.EmitLoadParam(reg) + reg := ec.ctx.Registers.Allocate(core.Temp) + ec.ctx.Emitter.EmitLoadParam(reg, ec.ctx.Symbols.BindParam(name)) return reg } diff --git a/pkg/compiler/internal/helpers.go b/pkg/compiler/internal/helpers.go index 49bbe10d..7cdfcb5e 100644 --- a/pkg/compiler/internal/helpers.go +++ b/pkg/compiler/internal/helpers.go @@ -1,10 +1,12 @@ package internal import ( + "strings" + + "github.com/antlr4-go/antlr/v4" + "github.com/MontFerret/ferret/pkg/compiler/internal/core" "github.com/MontFerret/ferret/pkg/vm" - "github.com/antlr4-go/antlr/v4" - "strings" "github.com/MontFerret/ferret/pkg/runtime" diff --git a/pkg/compiler/internal/lit_compiler.go b/pkg/compiler/internal/literal.go similarity index 99% rename from pkg/compiler/internal/lit_compiler.go rename to pkg/compiler/internal/literal.go index 5f63a7c2..e72fbaeb 100644 --- a/pkg/compiler/internal/lit_compiler.go +++ b/pkg/compiler/internal/literal.go @@ -1,13 +1,15 @@ package internal import ( + "strconv" + "strings" + + "github.com/antlr4-go/antlr/v4" + "github.com/MontFerret/ferret/pkg/compiler/internal/core" "github.com/MontFerret/ferret/pkg/parser/fql" "github.com/MontFerret/ferret/pkg/runtime" "github.com/MontFerret/ferret/pkg/vm" - "github.com/antlr4-go/antlr/v4" - "strconv" - "strings" ) type LiteralCompiler struct { diff --git a/pkg/compiler/internal/loop_compiler.go b/pkg/compiler/internal/loop.go similarity index 99% rename from pkg/compiler/internal/loop_compiler.go rename to pkg/compiler/internal/loop.go index 5dc11662..e251de39 100644 --- a/pkg/compiler/internal/loop_compiler.go +++ b/pkg/compiler/internal/loop.go @@ -1,11 +1,12 @@ package internal import ( + "github.com/antlr4-go/antlr/v4" + "github.com/MontFerret/ferret/pkg/compiler/internal/core" "github.com/MontFerret/ferret/pkg/parser/fql" "github.com/MontFerret/ferret/pkg/runtime" "github.com/MontFerret/ferret/pkg/vm" - "github.com/antlr4-go/antlr/v4" ) type LoopCompiler struct { diff --git a/pkg/compiler/internal/collect_compiler.go b/pkg/compiler/internal/loop_collect.go similarity index 100% rename from pkg/compiler/internal/collect_compiler.go rename to pkg/compiler/internal/loop_collect.go diff --git a/pkg/compiler/internal/stmt_compiler.go b/pkg/compiler/internal/stmt.go similarity index 100% rename from pkg/compiler/internal/stmt_compiler.go rename to pkg/compiler/internal/stmt.go diff --git a/pkg/compiler/internal/wait_compiler.go b/pkg/compiler/internal/wait.go similarity index 100% rename from pkg/compiler/internal/wait_compiler.go rename to pkg/compiler/internal/wait.go diff --git a/pkg/compiler/internal/visitor.go b/pkg/compiler/visitor.go similarity index 92% rename from pkg/compiler/internal/visitor.go rename to pkg/compiler/visitor.go index cd277a4a..862f6425 100644 --- a/pkg/compiler/internal/visitor.go +++ b/pkg/compiler/visitor.go @@ -1,34 +1,24 @@ -package internal +package compiler import ( - "github.com/MontFerret/ferret/pkg/compiler/internal/core" + "github.com/MontFerret/ferret/pkg/compiler/internal" "github.com/MontFerret/ferret/pkg/parser/fql" ) type Visitor struct { *fql.BaseFqlParserVisitor - ctx *FuncContext - Err error - Src string - Emitter *core.Emitter - Registers *core.RegisterAllocator - Symbols *core.SymbolTable - Loops *core.LoopTable - CatchTable *core.CatchStack + Ctx *internal.FuncContext + Err error + Src string } func NewVisitor(src string) *Visitor { v := new(Visitor) v.BaseFqlParserVisitor = new(fql.BaseFqlParserVisitor) - v.ctx = NewFuncContext() + v.Ctx = internal.NewFuncContext() v.Src = src - v.Registers = v.ctx.Registers - v.Symbols = v.ctx.Symbols - v.Loops = v.ctx.Loops - v.Emitter = v.ctx.Emitter - v.CatchTable = v.ctx.CatchTable return v } @@ -38,7 +28,7 @@ func (v *Visitor) VisitProgram(ctx *fql.ProgramContext) interface{} { v.VisitHead(head.(*fql.HeadContext)) } - v.ctx.StmtCompiler.Compile(ctx.Body()) + v.Ctx.StmtCompiler.Compile(ctx.Body()) return nil } @@ -47,7 +37,7 @@ func (v *Visitor) VisitHead(_ *fql.HeadContext) interface{} { return nil } -//func (v *Visitor) VisitCollectClause(ctx *fql.CollectClauseContext) interface{} { +//func (v *Visitor) VisitCollectClause(Ctx *fql.CollectClauseContext) interface{} { // // TODO: Undefine original loop variables // loop := v.Loops.Current() // @@ -58,9 +48,9 @@ func (v *Visitor) VisitHead(_ *fql.HeadContext) interface{} { // var kvKeyReg, kvValReg vm.Operand // var groupSelectors []fql.ICollectSelectorContext // var isGrouping bool -// grouping := ctx.CollectGrouping() -// counter := ctx.CollectCounter() -// aggregator := ctx.CollectAggregator() +// grouping := Ctx.CollectGrouping() +// counter := Ctx.CollectCounter() +// aggregator := Ctx.CollectAggregator() // // isCollecting := grouping != nil || counter != nil // @@ -78,7 +68,7 @@ func (v *Visitor) VisitHead(_ *fql.HeadContext) interface{} { // collectorType := CollectorTypeKey // // // If we have a collect group variable, we need to project it -// if groupVar := ctx.CollectGroupVariable(); groupVar != nil { +// if groupVar := Ctx.CollectGroupVariable(); groupVar != nil { // // Projection can be either a default projection (identifier) or a custom projection (selector expression) // if identifier := groupVar.Identifier(); identifier != nil { // projectionVariableName = v.emitCollectDefaultGroupProjection(loop, kvValReg, identifier, groupVar.CollectGroupVariableKeeper()) @@ -411,28 +401,28 @@ func (v *Visitor) VisitHead(_ *fql.HeadContext) interface{} { // return selector.Identifier().GetText() //} // -//func (v *Visitor) VisitCollectSelector(ctx *fql.CollectSelectorContext) interface{} { -// if c := ctx.Expression(); c != nil { +//func (v *Visitor) VisitCollectSelector(Ctx *fql.CollectSelectorContext) interface{} { +// if c := Ctx.Expression(); c != nil { // return c.Accept(v) // } // -// panic(runtime.Error(ErrUnexpectedToken, ctx.GetText())) +// panic(runtime.Error(ErrUnexpectedToken, Ctx.GetText())) //} // -//func (v *Visitor) VisitForExpressionStatement(ctx *fql.ForExpressionStatementContext) interface{} { -// if c := ctx.VariableDeclaration(); c != nil { +//func (v *Visitor) VisitForExpressionStatement(Ctx *fql.ForExpressionStatementContext) interface{} { +// if c := Ctx.VariableDeclaration(); c != nil { // return c.Accept(v) // } // -// if c := ctx.FunctionCallExpression(); c != nil { +// if c := Ctx.FunctionCallExpression(); c != nil { // return c.Accept(v) // } // -// panic(runtime.Error(ErrUnexpectedToken, ctx.GetText())) +// panic(runtime.Error(ErrUnexpectedToken, Ctx.GetText())) //} // -//func (v *Visitor) VisitExpression(ctx *fql.ExpressionContext) interface{} { -// return v.ctx.ExprCompiler.Compile(ctx) +//func (v *Visitor) VisitExpression(Ctx *fql.ExpressionContext) interface{} { +// return v.Ctx.ExprCompiler.Compile(Ctx) //} // //// emitIterValue emits an instruction to get the value from the iterator @@ -524,7 +514,7 @@ func (v *Visitor) VisitHead(_ *fql.HeadContext) interface{} { //} // //func (v *Visitor) loadConstant(constant runtime.Value) vm.Operand { -// return loadConstant(v.ctx, constant) +// return loadConstant(v.Ctx, constant) //} // //func (v *Visitor) loadConstantTo(constant runtime.Value, reg vm.Operand) { diff --git a/pkg/parser/fql/fql_lexer.go b/pkg/parser/fql/fql_lexer.go index 8651be8e..852f6faf 100644 --- a/pkg/parser/fql/fql_lexer.go +++ b/pkg/parser/fql/fql_lexer.go @@ -4,9 +4,10 @@ package fql import ( "fmt" - "github.com/antlr4-go/antlr/v4" "sync" "unicode" + + "github.com/antlr4-go/antlr/v4" ) // Suppress unused import error diff --git a/test/integration/benchmarks/compiler_bench_test.go b/test/integration/benchmarks/compiler_bench_test.go index a7152dc8..4a5d0c14 100644 --- a/test/integration/benchmarks/compiler_bench_test.go +++ b/test/integration/benchmarks/compiler_bench_test.go @@ -1,7 +1,6 @@ package benchmarks_test import ( - "github.com/MontFerret/ferret/test/integration/setup" "testing" ) diff --git a/test/integration/bytecode/compiler_test.go b/test/integration/bytecode/compiler_test.go index 09175fe2..d2b668cb 100644 --- a/test/integration/bytecode/compiler_test.go +++ b/test/integration/bytecode/compiler_test.go @@ -2,7 +2,6 @@ package bytecode_test import ( "fmt" - "github.com/MontFerret/ferret/test/integration/setup" "testing" "github.com/MontFerret/ferret/pkg/runtime" diff --git a/test/integration/vm/vm_for_collect_agg_test.go b/test/integration/vm/vm_for_collect_agg_test.go index c52d61dc..782ca315 100644 --- a/test/integration/vm/vm_for_collect_agg_test.go +++ b/test/integration/vm/vm_for_collect_agg_test.go @@ -1,8 +1,9 @@ package vm_test import ( - . "github.com/MontFerret/ferret/test/integration/base" "testing" + + . "github.com/MontFerret/ferret/test/integration/base" ) func TestCollectAggregate(t *testing.T) { diff --git a/test/integration/vm/vm_for_collect_test.go b/test/integration/vm/vm_for_collect_test.go index 29bd3829..60d342b2 100644 --- a/test/integration/vm/vm_for_collect_test.go +++ b/test/integration/vm/vm_for_collect_test.go @@ -1,8 +1,9 @@ package vm_test import ( - . "github.com/MontFerret/ferret/test/integration/base" "testing" + + . "github.com/MontFerret/ferret/test/integration/base" ) // COLLECT vs. RETURN DISTINCT diff --git a/test/integration/vm/vm_for_filter_test.go b/test/integration/vm/vm_for_filter_test.go index 3226e52f..c4a93b1d 100644 --- a/test/integration/vm/vm_for_filter_test.go +++ b/test/integration/vm/vm_for_filter_test.go @@ -2,10 +2,11 @@ package vm_test import ( "context" + "testing" + "github.com/MontFerret/ferret/pkg/runtime" "github.com/MontFerret/ferret/pkg/vm" . "github.com/MontFerret/ferret/test/integration/base" - "testing" ) func TestForFilter(t *testing.T) { diff --git a/test/integration/vm/vm_for_limit_test.go b/test/integration/vm/vm_for_limit_test.go index d3c5a9a6..e5390725 100644 --- a/test/integration/vm/vm_for_limit_test.go +++ b/test/integration/vm/vm_for_limit_test.go @@ -2,10 +2,11 @@ package vm_test import ( "context" + "testing" + "github.com/MontFerret/ferret/pkg/runtime" "github.com/MontFerret/ferret/pkg/vm" . "github.com/MontFerret/ferret/test/integration/base" - "testing" ) func TestForLimit(t *testing.T) { diff --git a/test/integration/vm/vm_for_sort_test.go b/test/integration/vm/vm_for_sort_test.go index 0f2a8424..c125cdb1 100644 --- a/test/integration/vm/vm_for_sort_test.go +++ b/test/integration/vm/vm_for_sort_test.go @@ -2,10 +2,11 @@ package vm_test import ( "context" + "testing" + "github.com/MontFerret/ferret/pkg/runtime" "github.com/MontFerret/ferret/pkg/vm" . "github.com/MontFerret/ferret/test/integration/base" - "testing" ) func TestForSort(t *testing.T) { diff --git a/test/integration/vm/vm_for_ternary_test.go b/test/integration/vm/vm_for_ternary_test.go index d9f78934..7be1f145 100644 --- a/test/integration/vm/vm_for_ternary_test.go +++ b/test/integration/vm/vm_for_ternary_test.go @@ -1,8 +1,9 @@ package vm_test import ( - . "github.com/MontFerret/ferret/test/integration/base" "testing" + + . "github.com/MontFerret/ferret/test/integration/base" ) func TestForTernaryExpression(t *testing.T) { diff --git a/test/integration/vm/vm_for_test.go b/test/integration/vm/vm_for_test.go index 197ccf02..fcffd00a 100644 --- a/test/integration/vm/vm_for_test.go +++ b/test/integration/vm/vm_for_test.go @@ -2,9 +2,10 @@ package vm_test import ( "context" - . "github.com/MontFerret/ferret/test/integration/base" "testing" + . "github.com/MontFerret/ferret/test/integration/base" + "github.com/MontFerret/ferret/pkg/runtime" "github.com/MontFerret/ferret/pkg/vm" ) diff --git a/test/integration/vm/vm_func_test.go b/test/integration/vm/vm_func_test.go index f70df1d9..803a3d69 100644 --- a/test/integration/vm/vm_func_test.go +++ b/test/integration/vm/vm_func_test.go @@ -1,8 +1,9 @@ package vm_test import ( - . "github.com/MontFerret/ferret/test/integration/base" "testing" + + . "github.com/MontFerret/ferret/test/integration/base" ) func TestFunctionCall(t *testing.T) { diff --git a/test/integration/vm/vm_member_test.go b/test/integration/vm/vm_member_test.go index 4d8b0c83..d332cd09 100644 --- a/test/integration/vm/vm_member_test.go +++ b/test/integration/vm/vm_member_test.go @@ -3,15 +3,16 @@ package vm_test import ( "context" "fmt" + "regexp" + "strconv" + "strings" + "testing" + "github.com/MontFerret/ferret/pkg/compiler" "github.com/MontFerret/ferret/pkg/parser" "github.com/MontFerret/ferret/pkg/runtime" "github.com/MontFerret/ferret/pkg/vm" . "github.com/MontFerret/ferret/test/integration/base" - "regexp" - "strconv" - "strings" - "testing" . "github.com/smartystreets/goconvey/convey" ) diff --git a/test/integration/vm/vm_op_array_test.go b/test/integration/vm/vm_op_array_test.go index a94ae510..005afb0d 100644 --- a/test/integration/vm/vm_op_array_test.go +++ b/test/integration/vm/vm_op_array_test.go @@ -1,8 +1,9 @@ package vm_test import ( - . "github.com/MontFerret/ferret/test/integration/base" "testing" + + . "github.com/MontFerret/ferret/test/integration/base" ) func TestArrayAllOperator(t *testing.T) { diff --git a/test/integration/vm/vm_op_equality_test.go b/test/integration/vm/vm_op_equality_test.go index 1cdaa82a..8f9976d0 100644 --- a/test/integration/vm/vm_op_equality_test.go +++ b/test/integration/vm/vm_op_equality_test.go @@ -1,8 +1,9 @@ package vm_test import ( - . "github.com/MontFerret/ferret/test/integration/base" "testing" + + . "github.com/MontFerret/ferret/test/integration/base" ) func TestEqualityOperators(t *testing.T) { diff --git a/test/integration/vm/vm_op_in_test.go b/test/integration/vm/vm_op_in_test.go index 064d945d..fd47597c 100644 --- a/test/integration/vm/vm_op_in_test.go +++ b/test/integration/vm/vm_op_in_test.go @@ -1,8 +1,9 @@ package vm_test import ( - . "github.com/MontFerret/ferret/test/integration/base" "testing" + + . "github.com/MontFerret/ferret/test/integration/base" ) func TestInOperator(t *testing.T) { diff --git a/test/integration/vm/vm_op_like_test.go b/test/integration/vm/vm_op_like_test.go index fae4aca9..fb4aa499 100644 --- a/test/integration/vm/vm_op_like_test.go +++ b/test/integration/vm/vm_op_like_test.go @@ -1,8 +1,9 @@ package vm_test import ( - . "github.com/MontFerret/ferret/test/integration/base" "testing" + + . "github.com/MontFerret/ferret/test/integration/base" ) func TestLikeOperator(t *testing.T) { diff --git a/test/integration/vm/vm_op_logical_test.go b/test/integration/vm/vm_op_logical_test.go index 5fbeadd9..94dc78f5 100644 --- a/test/integration/vm/vm_op_logical_test.go +++ b/test/integration/vm/vm_op_logical_test.go @@ -3,10 +3,11 @@ package vm_test import ( "context" "fmt" + "testing" + "github.com/MontFerret/ferret/pkg/runtime" "github.com/MontFerret/ferret/pkg/vm" . "github.com/MontFerret/ferret/test/integration/base" - "testing" ) func TestLogicalOperators(t *testing.T) { diff --git a/test/integration/vm/vm_op_math_test.go b/test/integration/vm/vm_op_math_test.go index 6de74c9b..ca4e05ad 100644 --- a/test/integration/vm/vm_op_math_test.go +++ b/test/integration/vm/vm_op_math_test.go @@ -1,8 +1,9 @@ package vm_test import ( - . "github.com/MontFerret/ferret/test/integration/base" "testing" + + . "github.com/MontFerret/ferret/test/integration/base" ) func TestMathOperators(t *testing.T) { diff --git a/test/integration/vm/vm_op_regex_test.go b/test/integration/vm/vm_op_regex_test.go index 49f9dea8..c79562a8 100644 --- a/test/integration/vm/vm_op_regex_test.go +++ b/test/integration/vm/vm_op_regex_test.go @@ -3,9 +3,10 @@ package vm_test import ( "context" "fmt" - . "github.com/MontFerret/ferret/test/integration/base" "testing" + . "github.com/MontFerret/ferret/test/integration/base" + "github.com/MontFerret/ferret/pkg/compiler" "github.com/MontFerret/ferret/pkg/runtime" "github.com/MontFerret/ferret/pkg/vm" diff --git a/test/integration/vm/vm_op_ternary_test.go b/test/integration/vm/vm_op_ternary_test.go index 172f2477..2ba0fe3f 100644 --- a/test/integration/vm/vm_op_ternary_test.go +++ b/test/integration/vm/vm_op_ternary_test.go @@ -2,9 +2,11 @@ package vm_test import ( "fmt" + + . "github.com/smartystreets/goconvey/convey" + "github.com/MontFerret/ferret/pkg/compiler" . "github.com/MontFerret/ferret/test/integration/base" - . "github.com/smartystreets/goconvey/convey" "testing" ) diff --git a/test/integration/vm/vm_op_unary_test.go b/test/integration/vm/vm_op_unary_test.go index d3e94d57..ff4553d9 100644 --- a/test/integration/vm/vm_op_unary_test.go +++ b/test/integration/vm/vm_op_unary_test.go @@ -1,12 +1,14 @@ package vm_test import ( + "testing" + "github.com/MontFerret/ferret/pkg/compiler" "github.com/MontFerret/ferret/pkg/vm" . "github.com/MontFerret/ferret/test/integration/base" - "testing" gocontext "context" + . "github.com/smartystreets/goconvey/convey" ) diff --git a/test/integration/vm/vm_param_test.go b/test/integration/vm/vm_param_test.go index 21846c2c..a06feac1 100644 --- a/test/integration/vm/vm_param_test.go +++ b/test/integration/vm/vm_param_test.go @@ -1,10 +1,11 @@ package vm_test import ( + "testing" + "github.com/MontFerret/ferret/pkg/runtime" "github.com/MontFerret/ferret/pkg/vm" . "github.com/MontFerret/ferret/test/integration/base" - "testing" ) func TestParam(t *testing.T) { diff --git a/test/integration/vm/vm_range_test.go b/test/integration/vm/vm_range_test.go index eed97cc7..1ada5f38 100644 --- a/test/integration/vm/vm_range_test.go +++ b/test/integration/vm/vm_range_test.go @@ -1,17 +1,18 @@ package vm_test import ( + "testing" + "github.com/MontFerret/ferret/pkg/runtime" "github.com/MontFerret/ferret/pkg/vm" . "github.com/MontFerret/ferret/test/integration/base" - "testing" ) func TestRange(t *testing.T) { RunUseCases(t, []UseCase{ - SkipCaseArray("RETURN 1..10", []any{1, 2, 3, 4, 5, 6, 7, 8, 9, 10}, "Should return a range from 1 to 10"), - SkipCaseArray("RETURN 10..1", []any{10, 9, 8, 7, 6, 5, 4, 3, 2, 1}, "Should return a range from 10 to 1"), - SkipCaseArray( + CaseArray("RETURN 1..10", []any{1, 2, 3, 4, 5, 6, 7, 8, 9, 10}, "Should return a range from 1 to 10"), + CaseArray("RETURN 10..1", []any{10, 9, 8, 7, 6, 5, 4, 3, 2, 1}, "Should return a range from 10 to 1"), + CaseArray( ` LET start = 1 LET end = 10 diff --git a/test/integration/vm/vm_string_test.go b/test/integration/vm/vm_string_test.go index 050f3d7a..3017822a 100644 --- a/test/integration/vm/vm_string_test.go +++ b/test/integration/vm/vm_string_test.go @@ -2,8 +2,9 @@ package vm_test import ( "fmt" - . "github.com/MontFerret/ferret/test/integration/base" "testing" + + . "github.com/MontFerret/ferret/test/integration/base" ) func TestString(t *testing.T) { diff --git a/test/integration/vm/vm_variable_test.go b/test/integration/vm/vm_variable_test.go index 5fbdb5f7..1f7fb36a 100644 --- a/test/integration/vm/vm_variable_test.go +++ b/test/integration/vm/vm_variable_test.go @@ -2,13 +2,15 @@ package vm_test import ( "fmt" + "testing" + "github.com/MontFerret/ferret/pkg/compiler" "github.com/MontFerret/ferret/pkg/runtime" "github.com/MontFerret/ferret/pkg/vm" . "github.com/MontFerret/ferret/test/integration/base" - "testing" gocontext "context" + . "github.com/smartystreets/goconvey/convey" ) diff --git a/test/integration/vm/vm_waitfor_event_test.go b/test/integration/vm/vm_waitfor_event_test.go index c9d9e1f2..99ca7a52 100644 --- a/test/integration/vm/vm_waitfor_event_test.go +++ b/test/integration/vm/vm_waitfor_event_test.go @@ -1,8 +1,9 @@ package vm_test import ( - . "github.com/MontFerret/ferret/test/integration/base" "testing" + + . "github.com/MontFerret/ferret/test/integration/base" ) func TestWaitforEvent(t *testing.T) { diff --git a/test/integration/vm/vm_while_do_test.go b/test/integration/vm/vm_while_do_test.go index 46fc099f..7c3142a5 100644 --- a/test/integration/vm/vm_while_do_test.go +++ b/test/integration/vm/vm_while_do_test.go @@ -2,9 +2,10 @@ package vm_test import ( "context" - . "github.com/MontFerret/ferret/test/integration/base" "testing" + . "github.com/MontFerret/ferret/test/integration/base" + "github.com/MontFerret/ferret/pkg/runtime" "github.com/MontFerret/ferret/pkg/vm" ) diff --git a/test/integration/vm/vm_while_ternary_test.go b/test/integration/vm/vm_while_ternary_test.go index 44c3c793..deb761f4 100644 --- a/test/integration/vm/vm_while_ternary_test.go +++ b/test/integration/vm/vm_while_ternary_test.go @@ -2,9 +2,10 @@ package vm_test import ( "context" - . "github.com/MontFerret/ferret/test/integration/base" "testing" + . "github.com/MontFerret/ferret/test/integration/base" + "github.com/MontFerret/ferret/pkg/runtime" "github.com/MontFerret/ferret/pkg/vm" ) diff --git a/test/integration/vm/vm_while_test.go b/test/integration/vm/vm_while_test.go index 40d1ab23..d4a3a95b 100644 --- a/test/integration/vm/vm_while_test.go +++ b/test/integration/vm/vm_while_test.go @@ -2,9 +2,10 @@ package vm_test import ( "context" - . "github.com/MontFerret/ferret/test/integration/base" "testing" + . "github.com/MontFerret/ferret/test/integration/base" + "github.com/MontFerret/ferret/pkg/runtime" "github.com/MontFerret/ferret/pkg/vm" )