Source file
misc/swig/stdio/file_test.go
1
2
3
4
5 package file
6
7 import "testing"
8
9
10
11 func TestRead(t *testing.T) {
12 f := Fopen("file_test.go", "r")
13 if f.Swigcptr() == 0 {
14 t.Fatal("fopen failed")
15 }
16 if Fgetc(f) != '/' || Fgetc(f) != '/' || Fgetc(f) != ' ' || Fgetc(f) != 'C' {
17 t.Error("read unexpected characters")
18 }
19 if Fclose(f) != 0 {
20 t.Error("fclose failed")
21 }
22 }
23
24 func TestF(t *testing.T) {
25 if x := F(); x != 1 {
26 t.Fatalf("x = %d, want 1", x)
27 }
28 }
29
View as plain text