func TestSessionShell(t *testing.T) {
	conn := dial(shellHandler, t)
	defer conn.Close()
	session, err := conn.NewSession()
	if err != nil {
		t.Fatalf("Unable to request new session: %v", err)
	}
	defer session.Close()
	stdout := new(bytes.Buffer)
	session.Stdout = stdout
	if err := session.Shell(); err != nil {
		t.Fatalf("Unable to execute command: %s", err)
	}
	if err := session.Wait(); err != nil {
		t.Fatalf("Remote command did not exit cleanly: %v", err)
	}
	actual := stdout.String()
	if actual != "golang" {
		t.Fatalf("Remote shell did not return expected string: expected=golang, actual=%s", actual)
	}
}
// Test a simple string is returned to session.Stdout.
Test a simple string is returned to session.Stdout.
// Test a simple string is returned to session . Stdout .
func TestSessionShell(t *testing.T) {
	conn := dial(shellHandler, t)
	defer conn.Close()
	session, err := conn.NewSession()
	if err != nil {
		t.Fatalf("Unable to request new session: %v", err)
	}
	defer session.Close()
	stdout := new(bytes.Buffer)
	session.Stdout = stdout
	if err := session.Shell(); err != nil {
		t.Fatalf("Unable to execute command: %s", err)
	}
	if err := session.Wait(); err != nil {
		t.Fatalf("Remote command did not exit cleanly: %v", err)
	}
	actual := stdout.String()
	if actual != "golang" {
		t.Fatalf("Remote shell did not return expected string: expected=golang, actual=%s", actual)
	}
}
func TestSessionShell ( t * testing . T ) { conn := dial ( shellHandler , t ) defer conn . Close ( ) session , err := conn . NewSession ( ) if err != nil { t . Fatalf ( " " , err ) } defer session . Close ( ) stdout := new ( bytes . Buffer ) session . Stdout = stdout if err := session . Shell ( ) ; err != nil { t . Fatalf ( " " , err ) } if err := session . Wait ( ) ; err != nil { t . Fatalf ( " " , err ) } actual := stdout . String ( ) if actual != " " { t . Fatalf ( " " , actual ) } }
Test a simple string is returned to session.Stdout.
Test a simple string is returned to session . Stdout .