| 1 |
package approvaltests |
| 2 |
|
| 3 |
import ( |
| 4 |
"strings" |
| 5 |
"testing" |
| 6 |
) |
| 7 |
|
| 8 |
func Test00(t *testing.T) { |
| 9 |
approvalName, err := getApprovalName() |
| 10 |
if err != nil { |
| 11 |
t.Fatalf("%s", err) |
| 12 |
} |
| 13 |
|
| 14 |
approvalFile := approvalName.getApprovalFile(".txt") |
| 15 |
assertEndsWith(approvalFile, "namer_test.Test00.approved.txt", t) |
| 16 |
|
| 17 |
receivedFile := approvalName.getReceivedFile(".txt") |
| 18 |
assertEndsWith(receivedFile, "namer_test.Test00.received.txt", t) |
| 19 |
} |
| 20 |
func assertEndsWith(s string, ending string, t *testing.T) { |
| 21 |
if !strings.HasSuffix(s, ending) { |
| 22 |
t.Fatalf("expected name to be '%s', but got %s", ending, s) |
| 23 |
} |
| 24 |
} |