~juju-qa/ubuntu/xenial/juju/2.0-rc2

« back to all changes in this revision

Viewing changes to src/golang.org/x/crypto/ssh/terminal/terminal_test.go

  • Committer: Nicholas Skaggs
  • Date: 2016-09-30 14:39:30 UTC
  • mfrom: (1.8.1)
  • Revision ID: nicholas.skaggs@canonical.com-20160930143930-vwwhrefh6ftckccy
import upstream

Show diffs side-by-side

added added

removed removed

Lines of Context:
6
6
 
7
7
import (
8
8
        "io"
 
9
        "os"
9
10
        "testing"
10
11
)
11
12
 
267
268
                }
268
269
        }
269
270
}
 
271
 
 
272
func TestMakeRawState(t *testing.T) {
 
273
        fd := int(os.Stdout.Fd())
 
274
        if !IsTerminal(fd) {
 
275
                t.Skip("stdout is not a terminal; skipping test")
 
276
        }
 
277
 
 
278
        st, err := GetState(fd)
 
279
        if err != nil {
 
280
                t.Fatalf("failed to get terminal state from GetState: %s", err)
 
281
        }
 
282
        defer Restore(fd, st)
 
283
        raw, err := MakeRaw(fd)
 
284
        if err != nil {
 
285
                t.Fatalf("failed to get terminal state from MakeRaw: %s", err)
 
286
        }
 
287
 
 
288
        if *st != *raw {
 
289
                t.Errorf("states do not match; was %v, expected %v", raw, st)
 
290
        }
 
291
}