diff options
author | Ayke van Laethem <[email protected]> | 2021-04-22 12:44:22 +0200 |
---|---|---|
committer | Ron Evans <[email protected]> | 2021-04-22 19:53:42 +0200 |
commit | 404b65941a373b5b22b454a4b7d698cf2b98f8bd (patch) | |
tree | 8d2ab78847165b1425fe5862d9e34f9af22fddb4 | |
parent | 25f3adb47ec715234599bb0d892ad79277400a5b (diff) | |
download | tinygo-404b65941a373b5b22b454a4b7d698cf2b98f8bd.tar.gz tinygo-404b65941a373b5b22b454a4b7d698cf2b98f8bd.zip |
transform: move tests to transform_test package
This allows for adding more advanced tests, for example tests that use
the compiler package so that test sources can be written in Go instead
of LLVM IR.
-rw-r--r-- | transform/allocs_test.go | 6 | ||||
-rw-r--r-- | transform/func-lowering_test.go | 6 | ||||
-rw-r--r-- | transform/gc_test.go | 7 | ||||
-rw-r--r-- | transform/globals_test.go | 5 | ||||
-rw-r--r-- | transform/goroutine_test.go | 6 | ||||
-rw-r--r-- | transform/interface-lowering_test.go | 5 | ||||
-rw-r--r-- | transform/interrupt_test.go | 5 | ||||
-rw-r--r-- | transform/maps_test.go | 5 | ||||
-rw-r--r-- | transform/panic_test.go | 6 | ||||
-rw-r--r-- | transform/rtcalls_test.go | 9 | ||||
-rw-r--r-- | transform/stacksize_test.go | 5 | ||||
-rw-r--r-- | transform/transform_test.go | 2 | ||||
-rw-r--r-- | transform/wasm-abi_test.go | 5 |
13 files changed, 44 insertions, 28 deletions
diff --git a/transform/allocs_test.go b/transform/allocs_test.go index 42c5292d1..9176b2ff9 100644 --- a/transform/allocs_test.go +++ b/transform/allocs_test.go @@ -1,10 +1,12 @@ -package transform +package transform_test import ( "testing" + + "github.com/tinygo-org/tinygo/transform" ) func TestAllocs(t *testing.T) { t.Parallel() - testTransform(t, "testdata/allocs", OptimizeAllocs) + testTransform(t, "testdata/allocs", transform.OptimizeAllocs) } diff --git a/transform/func-lowering_test.go b/transform/func-lowering_test.go index ee3d019dd..e88212454 100644 --- a/transform/func-lowering_test.go +++ b/transform/func-lowering_test.go @@ -1,10 +1,12 @@ -package transform +package transform_test import ( "testing" + + "github.com/tinygo-org/tinygo/transform" ) func TestFuncLowering(t *testing.T) { t.Parallel() - testTransform(t, "testdata/func-lowering", LowerFuncValues) + testTransform(t, "testdata/func-lowering", transform.LowerFuncValues) } diff --git a/transform/gc_test.go b/transform/gc_test.go index 64962f0a0..70412d6b6 100644 --- a/transform/gc_test.go +++ b/transform/gc_test.go @@ -1,21 +1,22 @@ -package transform +package transform_test import ( "testing" + "github.com/tinygo-org/tinygo/transform" "tinygo.org/x/go-llvm" ) func TestAddGlobalsBitmap(t *testing.T) { t.Parallel() testTransform(t, "testdata/gc-globals", func(mod llvm.Module) { - AddGlobalsBitmap(mod) + transform.AddGlobalsBitmap(mod) }) } func TestMakeGCStackSlots(t *testing.T) { t.Parallel() testTransform(t, "testdata/gc-stackslots", func(mod llvm.Module) { - MakeGCStackSlots(mod) + transform.MakeGCStackSlots(mod) }) } diff --git a/transform/globals_test.go b/transform/globals_test.go index 0dcb0608d..1b6f243b8 100644 --- a/transform/globals_test.go +++ b/transform/globals_test.go @@ -1,14 +1,15 @@ -package transform +package transform_test import ( "testing" + "github.com/tinygo-org/tinygo/transform" "tinygo.org/x/go-llvm" ) func TestApplyFunctionSections(t *testing.T) { t.Parallel() testTransform(t, "testdata/globals-function-sections", func(mod llvm.Module) { - ApplyFunctionSections(mod) + transform.ApplyFunctionSections(mod) }) } diff --git a/transform/goroutine_test.go b/transform/goroutine_test.go index e63b49239..4d4f0b198 100644 --- a/transform/goroutine_test.go +++ b/transform/goroutine_test.go @@ -1,14 +1,16 @@ -package transform +package transform_test import ( "testing" + + "github.com/tinygo-org/tinygo/transform" "tinygo.org/x/go-llvm" ) func TestGoroutineLowering(t *testing.T) { t.Parallel() testTransform(t, "testdata/coroutines", func(mod llvm.Module) { - err := LowerCoroutines(mod, false) + err := transform.LowerCoroutines(mod, false) if err != nil { panic(err) } diff --git a/transform/interface-lowering_test.go b/transform/interface-lowering_test.go index e1c3c2dcc..e1d56e480 100644 --- a/transform/interface-lowering_test.go +++ b/transform/interface-lowering_test.go @@ -1,15 +1,16 @@ -package transform +package transform_test import ( "testing" + "github.com/tinygo-org/tinygo/transform" "tinygo.org/x/go-llvm" ) func TestInterfaceLowering(t *testing.T) { t.Parallel() testTransform(t, "testdata/interface", func(mod llvm.Module) { - err := LowerInterfaces(mod, 0) + err := transform.LowerInterfaces(mod, 0) if err != nil { t.Error(err) } diff --git a/transform/interrupt_test.go b/transform/interrupt_test.go index 60d83da15..1740f4858 100644 --- a/transform/interrupt_test.go +++ b/transform/interrupt_test.go @@ -1,8 +1,9 @@ -package transform +package transform_test import ( "testing" + "github.com/tinygo-org/tinygo/transform" "tinygo.org/x/go-llvm" ) @@ -11,7 +12,7 @@ func TestInterruptLowering(t *testing.T) { for _, subtest := range []string{"avr", "cortexm"} { t.Run(subtest, func(t *testing.T) { testTransform(t, "testdata/interrupt-"+subtest, func(mod llvm.Module) { - errs := LowerInterrupts(mod, 0) + errs := transform.LowerInterrupts(mod, 0) if len(errs) != 0 { t.Fail() for _, err := range errs { diff --git a/transform/maps_test.go b/transform/maps_test.go index 2bfc7feff..1f821d4b9 100644 --- a/transform/maps_test.go +++ b/transform/maps_test.go @@ -1,8 +1,9 @@ -package transform +package transform_test import ( "testing" + "github.com/tinygo-org/tinygo/transform" "tinygo.org/x/go-llvm" ) @@ -10,7 +11,7 @@ func TestOptimizeMaps(t *testing.T) { t.Parallel() testTransform(t, "testdata/maps", func(mod llvm.Module) { // Run optimization pass. - OptimizeMaps(mod) + transform.OptimizeMaps(mod) // Run an optimization pass, to clean up the result. // This shows that all code related to the map is really eliminated. diff --git a/transform/panic_test.go b/transform/panic_test.go index df0782611..ea4efd0e7 100644 --- a/transform/panic_test.go +++ b/transform/panic_test.go @@ -1,10 +1,12 @@ -package transform +package transform_test import ( "testing" + + "github.com/tinygo-org/tinygo/transform" ) func TestReplacePanicsWithTrap(t *testing.T) { t.Parallel() - testTransform(t, "testdata/panic", ReplacePanicsWithTrap) + testTransform(t, "testdata/panic", transform.ReplacePanicsWithTrap) } diff --git a/transform/rtcalls_test.go b/transform/rtcalls_test.go index 819dc5acb..9073b0ea5 100644 --- a/transform/rtcalls_test.go +++ b/transform/rtcalls_test.go @@ -1,8 +1,9 @@ -package transform +package transform_test import ( "testing" + "github.com/tinygo-org/tinygo/transform" "tinygo.org/x/go-llvm" ) @@ -10,7 +11,7 @@ func TestOptimizeStringToBytes(t *testing.T) { t.Parallel() testTransform(t, "testdata/stringtobytes", func(mod llvm.Module) { // Run optimization pass. - OptimizeStringToBytes(mod) + transform.OptimizeStringToBytes(mod) }) } @@ -18,7 +19,7 @@ func TestOptimizeStringEqual(t *testing.T) { t.Parallel() testTransform(t, "testdata/stringequal", func(mod llvm.Module) { // Run optimization pass. - OptimizeStringEqual(mod) + transform.OptimizeStringEqual(mod) }) } @@ -26,6 +27,6 @@ func TestOptimizeReflectImplements(t *testing.T) { t.Parallel() testTransform(t, "testdata/reflect-implements", func(mod llvm.Module) { // Run optimization pass. - OptimizeReflectImplements(mod) + transform.OptimizeReflectImplements(mod) }) } diff --git a/transform/stacksize_test.go b/transform/stacksize_test.go index c7c6cdec9..c38a7b2f8 100644 --- a/transform/stacksize_test.go +++ b/transform/stacksize_test.go @@ -1,9 +1,10 @@ -package transform +package transform_test import ( "testing" "github.com/tinygo-org/tinygo/compileopts" + "github.com/tinygo-org/tinygo/transform" "tinygo.org/x/go-llvm" ) @@ -11,7 +12,7 @@ func TestCreateStackSizeLoads(t *testing.T) { t.Parallel() testTransform(t, "testdata/stacksize", func(mod llvm.Module) { // Run optimization pass. - CreateStackSizeLoads(mod, &compileopts.Config{ + transform.CreateStackSizeLoads(mod, &compileopts.Config{ Target: &compileopts.TargetSpec{ DefaultStackSize: 1024, }, diff --git a/transform/transform_test.go b/transform/transform_test.go index 28faf8681..584ad4357 100644 --- a/transform/transform_test.go +++ b/transform/transform_test.go @@ -1,4 +1,4 @@ -package transform +package transform_test // This file defines some helper functions for testing transforms. diff --git a/transform/wasm-abi_test.go b/transform/wasm-abi_test.go index abe5b30d7..a09129283 100644 --- a/transform/wasm-abi_test.go +++ b/transform/wasm-abi_test.go @@ -1,8 +1,9 @@ -package transform +package transform_test import ( "testing" + "github.com/tinygo-org/tinygo/transform" "tinygo.org/x/go-llvm" ) @@ -10,7 +11,7 @@ func TestWasmABI(t *testing.T) { t.Parallel() testTransform(t, "testdata/wasm-abi", func(mod llvm.Module) { // Run ABI change pass. - err := ExternalInt64AsPtr(mod) + err := transform.ExternalInt64AsPtr(mod) if err != nil { t.Errorf("failed to change wasm ABI: %v", err) } |