Skip to content

Commit f915632

Browse files
committed
fix: use cross-platform path separators in Rust compiler test
- Use filepath.Join() in test to generate expected path with OS-appropriate separators - On Windows, paths use backslash instead of forward slash - Add case-insensitive PATH prefix check to match implementation - Fixes Windows CI test failure
1 parent 82c9d38 commit f915632

File tree

1 file changed

+7
-2
lines changed
  • internal/features/scripting/infrastructure/compilers

1 file changed

+7
-2
lines changed

internal/features/scripting/infrastructure/compilers/rust_test.go

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package compilers
22

33
import (
44
"context"
5+
"path/filepath"
56
"strings"
67
"testing"
78
"time"
@@ -701,6 +702,9 @@ func TestRustCompiler_GetRustEnv_WithBothHomes(t *testing.T) {
701702

702703
env := compiler.getRustEnv()
703704

705+
// Expected path with proper OS separators
706+
expectedCargoBin := filepath.Join("/test/cargo", "bin")
707+
704708
// Проверяем что RUSTUP_HOME установлен
705709
foundRustupHome := false
706710
foundCargoHome := false
@@ -713,7 +717,8 @@ func TestRustCompiler_GetRustEnv_WithBothHomes(t *testing.T) {
713717
if strings.Contains(e, "CARGO_HOME=/test/cargo") {
714718
foundCargoHome = true
715719
}
716-
if strings.HasPrefix(e, "PATH=") && strings.Contains(e, "/test/cargo/bin") {
720+
// Use case-insensitive prefix check for PATH and check for expected cargo bin path
721+
if len(e) >= 5 && strings.EqualFold(e[:5], "PATH=") && strings.Contains(e, expectedCargoBin) {
717722
foundPath = true
718723
}
719724
}
@@ -727,7 +732,7 @@ func TestRustCompiler_GetRustEnv_WithBothHomes(t *testing.T) {
727732
}
728733

729734
if !foundPath {
730-
t.Error("PATH should include cargo/bin")
735+
t.Errorf("PATH should include cargo/bin (%s)", expectedCargoBin)
731736
}
732737
}
733738

0 commit comments

Comments
 (0)