2017-08-27 11:45:15 +00:00
|
|
|
package main
|
|
|
|
|
2017-10-15 19:35:50 +00:00
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
"gopkg.in/urfave/cli.v2"
|
|
|
|
"reflect"
|
|
|
|
"testing"
|
|
|
|
)
|
|
|
|
|
|
|
|
func TestPrefix(t *testing.T) {
|
|
|
|
input := random(10)
|
2017-10-22 21:54:02 +00:00
|
|
|
value := fmt.Sprint(yellow.bold("["), "REALIZE", yellow.bold("]"), " : ", input)
|
2017-10-15 19:35:50 +00:00
|
|
|
result := prefix(input)
|
|
|
|
if result == "" {
|
|
|
|
t.Fatal("Expected a string")
|
|
|
|
}
|
|
|
|
if result != value {
|
|
|
|
t.Fatal("Expected", value, "Instead", result)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func TestBefore(t *testing.T) {
|
|
|
|
context := cli.Context{}
|
|
|
|
if err := before(&context); err != nil {
|
|
|
|
t.Fatal(err)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func TestNew(t *testing.T) {
|
|
|
|
r := new()
|
|
|
|
if reflect.TypeOf(r).String() != "main.realize" {
|
|
|
|
t.Error("Expected a realize struct")
|
|
|
|
}
|
|
|
|
}
|