1// +build windows
2
3package isatty
4
5import (
6	"testing"
7)
8
9func TestCygwinPipeName(t *testing.T) {
10	tests := []struct {
11		name   string
12		result bool
13	}{
14		{``, false},
15		{`\msys-`, false},
16		{`\cygwin-----`, false},
17		{`\msys-x-PTY5-pty1-from-master`, false},
18		{`\cygwin-x-PTY5-from-master`, false},
19		{`\cygwin-x-pty2-from-toaster`, false},
20		{`\cygwin--pty2-from-master`, false},
21		{`\\cygwin-x-pty2-from-master`, false},
22		{`\cygwin-x-pty2-from-master-`, true}, // for the feature
23		{`\cygwin-e022582115c10879-pty4-from-master`, true},
24		{`\msys-e022582115c10879-pty4-to-master`, true},
25		{`\cygwin-e022582115c10879-pty4-to-master`, true},
26	}
27
28	for _, test := range tests {
29		want := test.result
30		got := isCygwinPipeName(test.name)
31		if want != got {
32			t.Fatalf("isatty(%q): got %v, want %v:", test.name, got, want)
33		}
34	}
35}
36