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.
 
 
 
 

19 lines
444 B

package student_test
import (
"bytes"
"os/exec"
"testing"
)
func TestPrintProgramName(t *testing.T) {
b, err := exec.Command("go", "run", "./student/printprogramname").Output()
if err != nil {
t.Fatal(err)
}
if string(bytes.TrimSpace(b)) != "printprogramname" {
t.Fatal("Failed to print the program name")
}
}
// TODO: add more test cases (different program names), to do so compile then rename and test the binary several times