internal: remove problematic test case
A test case for AbsRelPath does not work on all platforms and does not
bring much value. We delete it then.
Fixes golang/go#56838
Change-Id: Ia8b24e36e909d2bd3f601e9cd5ec3aa0ffe51eb1
Reviewed-on: https://go-review.googlesource.com/c/vuln/+/452655
Run-TryBot: Zvonimir Pavlinovic <zpavlinovic@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Jonathan Amsterdam <jba@google.com>
diff --git a/internal/filepath_test.go b/internal/filepath_test.go
index 1f64d77..eac0ef1 100644
--- a/internal/filepath_test.go
+++ b/internal/filepath_test.go
@@ -5,32 +5,19 @@
package internal
import (
- "os"
"path/filepath"
"testing"
)
func TestAbsRelShorter(t *testing.T) {
- thisFile := "filepath_test.go"
- thisFileAbs, _ := filepath.Abs(thisFile)
-
- tf, err := os.CreateTemp("", "filepath_test.gp")
- if err != nil {
- t.Errorf("could not create temporary filepath_test.go file: %v", err)
- }
- tempFile := tf.Name()
- tempFileAbs, _ := filepath.Abs(tempFile)
+ thisFileAbs, _ := filepath.Abs("filepath_test.go")
for _, test := range []struct {
l string
want string
}{
- {thisFile, "filepath_test.go"},
+ {"filepath_test.go", "filepath_test.go"},
{thisFileAbs, "filepath_test.go"},
- // Relative path to temp file from "." is longer as
- // it needs to go back the length of the absolute
- // path and then in addition go to os.TempDir.
- {tempFile, tempFileAbs},
} {
if got := AbsRelShorter(test.l); got != test.want {
t.Errorf("want %s; got %s", test.want, got)