From 0a5216ebdb28fafa4fae6082631b2260dbedc4e1 Mon Sep 17 00:00:00 2001 From: Eduard Urbach Date: Sun, 20 Jul 2025 14:06:56 +0200 Subject: [PATCH] Moved the compiler test for missing main functions --- src/compiler/Compile_test.go | 8 -------- src/compiler/errors_test.go | 1 + src/compiler/testdata/MissingMainFunction.q | 0 3 files changed, 1 insertion(+), 8 deletions(-) create mode 100644 src/compiler/testdata/MissingMainFunction.q diff --git a/src/compiler/Compile_test.go b/src/compiler/Compile_test.go index 97cdbbe..632c73e 100644 --- a/src/compiler/Compile_test.go +++ b/src/compiler/Compile_test.go @@ -1,7 +1,6 @@ package compiler_test import ( - "errors" "testing" "git.urbach.dev/cli/q/src/compiler" @@ -15,13 +14,6 @@ func TestNotExisting(t *testing.T) { assert.NotNil(t, err) } -func TestNoInputFiles(t *testing.T) { - b := config.New(".") - _, err := compiler.Compile(b) - assert.NotNil(t, err) - assert.True(t, errors.Is(err, compiler.MissingMainFunction)) -} - func TestHelloExample(t *testing.T) { b := config.New("../../examples/hello") _, err := compiler.Compile(b) diff --git a/src/compiler/errors_test.go b/src/compiler/errors_test.go index 451ac7a..f2bfb75 100644 --- a/src/compiler/errors_test.go +++ b/src/compiler/errors_test.go @@ -14,6 +14,7 @@ var errs = []struct { File string ExpectedError error }{ + {"MissingMainFunction.q", compiler.MissingMainFunction}, {"UnusedImport.q", &compiler.UnusedImport{Package: "os"}}, } diff --git a/src/compiler/testdata/MissingMainFunction.q b/src/compiler/testdata/MissingMainFunction.q new file mode 100644 index 0000000..e69de29 -- 2.51.2