LEFT | RIGHT |
(no file at all) | |
1 // Copyright 2011 The Go Authors. All rights reserved. | 1 // Copyright 2011 The Go Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style | 2 // Use of this source code is governed by a BSD-style |
3 // license that can be found in the LICENSE file. | 3 // license that can be found in the LICENSE file. |
4 | 4 |
5 package terminal | 5 package terminal |
6 | 6 |
7 import ( | 7 import ( |
8 "io" | 8 "io" |
9 "testing" | 9 "testing" |
10 ) | 10 ) |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 line: "line1", | 95 line: "line1", |
96 throwAwayLines: 1, | 96 throwAwayLines: 1, |
97 }, | 97 }, |
98 { | 98 { |
99 // recall two previous lines and append. | 99 // recall two previous lines and append. |
100 in: "line1\rline2\rline3\x1b[A\x1b[Axxx\r", | 100 in: "line1\rline2\rline3\x1b[A\x1b[Axxx\r", |
101 line: "line1xxx", | 101 line: "line1xxx", |
102 throwAwayLines: 2, | 102 throwAwayLines: 2, |
103 }, | 103 }, |
104 { | 104 { |
| 105 in: "a b \001\013\r", |
| 106 line: "", |
| 107 }, |
| 108 { |
| 109 in: "a b \001\005\013\r", |
| 110 line: "a b ", |
| 111 }, |
| 112 { |
105 in: "\027\r", | 113 in: "\027\r", |
106 line: "", | 114 line: "", |
107 }, | 115 }, |
108 { | 116 { |
109 in: "a\027\r", | 117 in: "a\027\r", |
110 line: "", | 118 line: "", |
111 }, | 119 }, |
112 { | 120 { |
113 in: "a \027\r", | 121 in: "a \027\r", |
114 line: "", | 122 line: "", |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
188 ss := NewTerminal(c, "> ") | 196 ss := NewTerminal(c, "> ") |
189 pw, _ := ss.ReadPassword("> ") | 197 pw, _ := ss.ReadPassword("> ") |
190 if pw != "password" { | 198 if pw != "password" { |
191 t.Fatalf("failed to read password, got %s", pw) | 199 t.Fatalf("failed to read password, got %s", pw) |
192 } | 200 } |
193 line, _ := ss.ReadLine() | 201 line, _ := ss.ReadLine() |
194 if len(line) > 0 { | 202 if len(line) > 0 { |
195 t.Fatalf("password was saved in history") | 203 t.Fatalf("password was saved in history") |
196 } | 204 } |
197 } | 205 } |
LEFT | RIGHT |