MCPcopy
hub / github.com/containers/toolbox / TestNewStateFromDifferent

Function TestNewStateFromDifferent

src/pkg/term/term_test.go:48–65  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

46}
47
48func TestNewStateFromDifferent(t *testing.T) {
49 file, err := os.OpenFile("/dev/ptmx", os.O_RDWR, 0)
50 assert.NoError(t, err)
51 defer file.Close()
52
53 oldState, err := GetState(file)
54 assert.NoError(t, err)
55 assert.Equal(t, uint32(unix.ECHO), oldState.Lflag&unix.ECHO)
56 assert.Equal(t, uint32(unix.ICANON), oldState.Lflag&unix.ICANON)
57 assert.NotEqual(t, uint8(13), oldState.Cc[unix.VMIN])
58 assert.NotEqual(t, uint8(42), oldState.Cc[unix.VTIME])
59
60 newState := NewStateFrom(oldState, WithVMIN(13), WithVTIME(42), WithoutECHO(), WithoutICANON())
61 assert.Empty(t, newState.Lflag&unix.ECHO)
62 assert.Empty(t, newState.Lflag&unix.ICANON)
63 assert.Equal(t, uint8(13), newState.Cc[unix.VMIN])
64 assert.Equal(t, uint8(42), newState.Cc[unix.VTIME])
65}
66
67func TestNewStateFromNOP(t *testing.T) {
68 file, err := os.OpenFile("/dev/ptmx", os.O_RDWR, 0)

Callers

nothing calls this directly

Calls 6

GetStateFunction · 0.85
NewStateFromFunction · 0.85
WithVMINFunction · 0.85
WithVTIMEFunction · 0.85
WithoutECHOFunction · 0.85
WithoutICANONFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…