aboutsummaryrefslogtreecommitdiff
path: root/libgo/go/exp/ssh/common_test.go
blob: 058fb04fe1b482bc751180eedfa613f05f0b3384 (plain)
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
// Copyright 2011 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

package ssh

import (
	"testing"
)

func TestSafeString(t *testing.T) {
	strings := map[string]string{
		"\x20\x0d\x0a":  "\x20\x0d\x0a",
		"flibble":       "flibble",
		"new\x20line":   "new\x20line",
		"123456\x07789": "123456 789",
		"\t\t\x10\r\n":  "\t\t \r\n",
	}

	for s, expected := range strings {
		actual := safeString(s)
		if expected != actual {
			t.Errorf("expected: %v, actual: %v", []byte(expected), []byte(actual))
		}
	}
}