Skip to content

Commit 62ca3d9

Browse files
committed
fix: address path-related issue in Windows tests
Signed-off-by: Donnie Adams <[email protected]>
1 parent a9d02ed commit 62ca3d9

File tree

1 file changed

+17
-17
lines changed

1 file changed

+17
-17
lines changed

exec_test.go

+17-17
Original file line numberDiff line numberDiff line change
@@ -531,39 +531,39 @@ func TestDetermineProperCommand(t *testing.T) {
531531
},
532532
{
533533
name: "bin set to absolute path",
534-
bin: "/usr/local/bin/gptscript",
535-
dir: "/usr/local",
536-
want: "/usr/local/bin/gptscript",
534+
bin: string(os.PathSeparator) + filepath.Join("usr", "local", "bin", "gptscript"),
535+
dir: string(os.PathSeparator) + filepath.Join("usr", "local"),
536+
want: string(os.PathSeparator) + filepath.Join("usr", "local", "bin", "gptscript"),
537537
},
538538
{
539539
name: "bin set to relative path",
540-
bin: "../bin/gptscript",
541-
dir: "/usr/local",
542-
want: "../bin/gptscript",
540+
bin: filepath.Join("..", "bin", "gptscript"),
541+
dir: string(os.PathSeparator) + filepath.Join("usr", "local"),
542+
want: filepath.Join("..", "bin", "gptscript"),
543543
},
544544
{
545545
name: "bin set to relative 'to me' path with os.Args[0]",
546-
bin: "<me>/../bin/gptscript",
546+
bin: "<me>" + string(os.PathSeparator) + filepath.Join("..", "bin", "gptscript"),
547547
dir: filepath.Dir(os.Args[0]),
548-
want: filepath.Join(filepath.Dir(os.Args[0]), "../bin/gptscript"),
548+
want: filepath.Join(filepath.Dir(os.Args[0]), filepath.Join("..", "bin", "gptscript")),
549549
},
550550
{
551551
name: "env var set to relative 'to me' path with extra and dir is current",
552-
bin: "<me>/../bin/gptscript",
553-
dir: "./",
554-
want: "./../bin/gptscript",
552+
bin: "<me>" + string(os.PathSeparator) + filepath.Join("..", "bin", "gptscript"),
553+
dir: ".",
554+
want: "." + string(os.PathSeparator) + filepath.Join("..", "bin", "gptscript"),
555555
},
556556
{
557557
name: "env var set to relative 'to me' path and dir is current",
558-
bin: "<me>/gptscript",
559-
dir: "./",
560-
want: "./gptscript",
558+
bin: "<me>" + string(os.PathSeparator) + "gptscript",
559+
dir: ".",
560+
want: "." + string(os.PathSeparator) + "gptscript",
561561
},
562562
{
563563
name: "env var set to relative 'to me' path with extra and dir is current",
564-
bin: "<me>/../bin/gptscript",
565-
dir: "./",
566-
want: "./../bin/gptscript",
564+
bin: "<me>" + string(os.PathSeparator) + filepath.Join("..", "bin", "gptscript"),
565+
dir: ".",
566+
want: "." + string(os.PathSeparator) + filepath.Join("..", "bin", "gptscript"),
567567
},
568568
}
569569
for _, tt := range tests {

0 commit comments

Comments
 (0)