You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

30 lines
643 B

package student_test
import (
"strings"
"testing"
"github.com/01-edu/z01"
)
func TestPrintProgramName(t *testing.T) {
exercise := strings.ToLower(
strings.TrimPrefix(t.Name(), "Test"))
out, err1 := z01.MainOut("./student/printprogramname")
if err1 != nil {
t.Fatalf(err1.Error())
}
correct, err2 := z01.MainOut("./solutions/printprogramname")
if err2 != nil {
t.Fatalf(err2.Error())
}
arrOut := strings.Split(out, "/")
ArrCor := strings.Split(correct, "/")
if ArrCor[len(ArrCor)-1] != arrOut[len(arrOut)-1] {
t.Fatalf("./%s prints %q instead of %q\n",
exercise, arrOut[len(arrOut)-1], ArrCor[len(ArrCor)-1])
}
}