(t *testing.T)
| 29 | } |
| 30 | |
| 31 | func TestWebStart_FileInsteadOfDirectory(t *testing.T) { |
| 32 | resetWebFlags() |
| 33 | |
| 34 | tmpDir := t.TempDir() |
| 35 | filePath := filepath.Join(tmpDir, "not-a-dir.txt") |
| 36 | if err := os.WriteFile(filePath, []byte("hello"), 0644); err != nil { |
| 37 | t.Fatalf("failed to create test file: %v", err) |
| 38 | } |
| 39 | |
| 40 | taskDir = filePath |
| 41 | |
| 42 | err := runWebStart(webStartCmd, nil) |
| 43 | if err == nil { |
| 44 | t.Fatal("expected error when task-dir points to a file") |
| 45 | } |
| 46 | |
| 47 | if !strings.Contains(err.Error(), "not a valid directory") { |
| 48 | t.Errorf("expected 'not a valid directory' error, got: %v", err) |
| 49 | } |
| 50 | } |
nothing calls this directly
no test coverage detected