Page MenuHomePhabricator

app_test.go
No OneTemporary

app_test.go

package sshtunnel
import (
"testing"
"fmt"
)
//function
func TestEndPointString(t *testing.T) {
var testend Endpoint
testend.Host = "localhost"
testend.Port = 5555
// make a string and test what the string should be
stringWant := "localhost:5555"
returnedString := testend.String()
fmt.Printf("stringWant: %s\n", stringWant)
fmt.Printf("returnedString : %s\n", returnedString)
// return string == stringwant // success
}
//function
func TestEndPointParseString(t *testing.T) {
var testRemote Endpoint
var testLocal Endpoint
// make a string and test what the string should be
testLocal, testRemote = ParseEndpointString("5555:motherbrain.unr.edu:5555")
fmt.Printf("Local: %s %d\n", testLocal.Host, testLocal.Port)
fmt.Printf("Remote: %s %d \n", testRemote.Host, testRemote.Port)
if testLocal.Host != "localhost"{
t.Error("Invalid Local EP Hostname")
}
if testLocal.Port != 5555 {
t.Error("Invalid Local EP Port")
}
if testRemote.Host != "motherbrain.unr.edu"{
t.Error("Invalid Local EP Hostname")
}
if testRemote.Port != 5555 {
t.Error("Invalid Local EP Port")
}
// return string == stringwant // success
}

File Metadata

Mime Type
text/plain
Expires
Tue, Feb 25, 2:39 PM (1 d, 11 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
15215
Default Alt Text
app_test.go (1 KB)

Event Timeline