Added direction notes
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package kmb
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
query "github.com/tgckpg/golifehk/query"
|
||||
@@ -36,11 +37,21 @@ func ( this *QueryResult ) Message() ( string, error ) {
|
||||
sb.WriteString( "\n " )
|
||||
for _, route := range *b.Routes {
|
||||
utils.WriteMDv2Text( &sb, route.RouteId )
|
||||
if route.Direction == "O" {
|
||||
sb.WriteString( "↑" )
|
||||
} else if route.Direction == "I" {
|
||||
sb.WriteString( "↓" )
|
||||
}
|
||||
if route.ServiceType != "1" {
|
||||
utils.WriteMDv2Text( &sb, utils.ToPower( route.ServiceType ) )
|
||||
}
|
||||
sb.WriteString( " " )
|
||||
}
|
||||
sb.WriteString( "\n" )
|
||||
}
|
||||
}
|
||||
fmt.Print( this.Query.Key )
|
||||
} else {
|
||||
}
|
||||
|
||||
return sb.String(), nil
|
||||
|
@@ -6,5 +6,16 @@ import (
|
||||
)
|
||||
|
||||
func TestQuerySchedule( t *testing.T ) {
|
||||
fmt.Print( Query( "zh", "大欖" ).Message() )
|
||||
qo := Query( "zh-Hant", "68X" )
|
||||
mesg, err := qo.Message()
|
||||
if err != nil {
|
||||
t.Errorf( "Unexpected Error: %s", err )
|
||||
}
|
||||
fmt.Println( mesg )
|
||||
|
||||
qo = Query( "zh-Hant", "K66 朗屏" )
|
||||
mesg, err = qo.Message()
|
||||
if err == nil {
|
||||
t.Errorf( "Expected Error: %s, got \"\" instead", mesg )
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user