File tree 1 file changed +30
-1
lines changed
1 file changed +30
-1
lines changed Original file line number Diff line number Diff line change @@ -6,6 +6,8 @@ package main
6
6
7
7
import (
8
8
"io/ioutil"
9
+ "os"
10
+ "path/filepath"
9
11
"strings"
10
12
"testing"
11
13
)
@@ -14,7 +16,34 @@ import (
14
16
// Test that we have one embedded resource.
15
17
//
16
18
func TestResourceCount (t * testing.T ) {
17
- expected := 14
19
+
20
+ expected := 0
21
+
22
+ // We're going to compare what is embedded with
23
+ // what is on-disk.
24
+ //
25
+ // We could just hard-wire the count, but that
26
+ // would require updating the count every time
27
+ // we add/remove a new resource
28
+ err := filepath .Walk ("data" ,
29
+ func (path string , info os.FileInfo , err error ) error {
30
+ if err != nil {
31
+ return err
32
+ }
33
+ if ! info .IsDir () {
34
+ expected ++
35
+ }
36
+ return nil
37
+ })
38
+ if err != nil {
39
+ t .Errorf ("failed to find resources beneath data/ %s" , err .Error ())
40
+ }
41
+
42
+ // ARBITRARY!
43
+ if expected < 10 {
44
+ t .Fatalf ("we expected more than 10 files beneath data/" )
45
+ }
46
+
18
47
out := getResources ()
19
48
20
49
if len (out ) != expected {
You can’t perform that action at this time.
0 commit comments