~evanj/embed

ref: 9f4e4dc945aca6b5462c38db63977663763d0fd4 embed/embed_test.go -rw-r--r-- 464 bytes
9f4e4dc9Evan M Jones Feat(embed.go): Changing impl. from string based to rune based. Can 1 year, 7 months ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
package main

import (
	"io/ioutil"
	"testing"
)

//go:generate go build
//go:generate ./embed -pattern t/* -id example

func TestBasic(t *testing.T) {
	str, ok := Get("t/hello.txt")
	if ok != true {
		t.Fail()
	}
	if "here we go\n" != str {
		t.Fail()
	}
}

func TestWeird(t *testing.T) {
	f, err := ioutil.ReadFile("t/weird.txt")
	if err != nil {
		t.Fail()
	}
	str, ok := Get("t/weird.txt")
	if ok != true {
		t.Fail()
	}
	if string(f) != str {
		t.Fail()
	}
}