-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain_windows_test.go
More file actions
39 lines (33 loc) · 1.07 KB
/
Copy pathmain_windows_test.go
File metadata and controls
39 lines (33 loc) · 1.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
//go:build windows
package main
import "testing"
func TestJournalPathsWindows(t *testing.T) {
home := `C:\Users\jot`
dir, txtPath, jsonlPath := journalPaths(home)
if dir != `C:\Users\jot\.jot` {
t.Fatalf("expected dir %q, got %q", `C:\Users\jot\.jot`, dir)
}
if txtPath != `C:\Users\jot\.jot\journal.txt` {
t.Fatalf("expected path %q, got %q", `C:\Users\jot\.jot\journal.txt`, txtPath)
}
if jsonlPath != `C:\Users\jot\.jot\journal.jsonl` {
t.Fatalf("expected path %q, got %q", `C:\Users\jot\.jot\journal.jsonl`, jsonlPath)
}
}
func TestIsGoTestBinary(t *testing.T) {
tests := []struct {
name string
args []string
want bool
}{
{name: "empty", args: nil, want: false},
{name: "regular exe", args: []string{`C:\Tools\jot.exe`}, want: false},
{name: "go test exe", args: []string{`C:\Temp\jot.test.exe`}, want: true},
{name: "go test binary without exe suffix", args: []string{`/tmp/jot.test`}, want: true},
}
for _, tt := range tests {
if got := isGoTestBinary(tt.args); got != tt.want {
t.Fatalf("%s: expected %v, got %v", tt.name, tt.want, got)
}
}
}