File: isatty_windows_test.go

package info (click to toggle)
golang-github-mattn-go-isatty 0.0.8-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, experimental, sid
  • size: 120 kB
  • sloc: makefile: 2
file content (35 lines) | stat: -rw-r--r-- 831 bytes parent folder | download | duplicates (7)
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
// +build windows

package isatty

import (
	"testing"
)

func TestCygwinPipeName(t *testing.T) {
	tests := []struct {
		name   string
		result bool
	}{
		{``, false},
		{`\msys-`, false},
		{`\cygwin-----`, false},
		{`\msys-x-PTY5-pty1-from-master`, false},
		{`\cygwin-x-PTY5-from-master`, false},
		{`\cygwin-x-pty2-from-toaster`, false},
		{`\cygwin--pty2-from-master`, false},
		{`\\cygwin-x-pty2-from-master`, false},
		{`\cygwin-x-pty2-from-master-`, true}, // for the feature
		{`\cygwin-e022582115c10879-pty4-from-master`, true},
		{`\msys-e022582115c10879-pty4-to-master`, true},
		{`\cygwin-e022582115c10879-pty4-to-master`, true},
	}

	for _, test := range tests {
		want := test.result
		got := isCygwinPipeName(test.name)
		if want != got {
			t.Fatalf("isatty(%q): got %v, want %v:", test.name, got, want)
		}
	}
}