...
1 package main
2
3 import (
4 "os/exec"
5 "strings"
6 "testing"
7 )
8
9 func TestMakefont(t *testing.T) {
10 var out []byte
11 var err error
12 const expect = "Font definition file successfully generated"
13
14 err = exec.Command("go", "build").Run()
15 if err != nil {
16 t.Fatal(err)
17 }
18 out, err = exec.Command("./makefont", "--dst=../font", "--embed",
19 "--enc=../font/cp1252.map", "../font/calligra.ttf").CombinedOutput()
20 if err != nil {
21 t.Fatal(err)
22 }
23 if !strings.Contains(string(out), expect) {
24 t.Fatalf("Unexpected output from makefont")
25 }
26 }
27
View as plain text