From be028a52d1f2d6a5b4122d643601fcd0ba5f6c66 Mon Sep 17 00:00:00 2001 From: Eduard Urbach Date: Fri, 14 Feb 2025 20:57:13 +0100 Subject: [PATCH] Fixed build package tests on Windows --- src/build/build_test.go | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/src/build/build_test.go b/src/build/build_test.go index 36242d8..e442e12 100644 --- a/src/build/build_test.go +++ b/src/build/build_test.go @@ -5,6 +5,7 @@ import ( "testing" "git.akyoto.dev/cli/q/src/build" + "git.akyoto.dev/cli/q/src/config" "git.akyoto.dev/go/assert" ) @@ -22,12 +23,24 @@ func TestBuildFile(t *testing.T) { func TestExecutableFromDirectory(t *testing.T) { b := build.New("../../examples/hello") - assert.Equal(t, filepath.Base(b.Executable()), "hello") + exe := filepath.Base(b.Executable()) + + if config.TargetOS != config.Windows { + assert.Equal(t, exe, "hello") + } else { + assert.Equal(t, exe, "hello.exe") + } } func TestExecutableFromFile(t *testing.T) { b := build.New("../../examples/hello/hello.q") - assert.Equal(t, filepath.Base(b.Executable()), "hello") + exe := filepath.Base(b.Executable()) + + if config.TargetOS != config.Windows { + assert.Equal(t, exe, "hello") + } else { + assert.Equal(t, exe, "hello.exe") + } } func TestNonExisting(t *testing.T) {