-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdefinition_test.go
More file actions
47 lines (38 loc) · 884 Bytes
/
definition_test.go
File metadata and controls
47 lines (38 loc) · 884 Bytes
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
package schema
import (
"bytes"
"os"
"testing"
)
//Test that Definitions can be initialized, serialized, and desreialized
func TestDefinitionJson(t *testing.T) {
var definition = &Definition{
Info: InfoDef{"Name", "Description", "URL"},
Tables: map[string]Table{
"The Table": Table{
Sources: []Source{
"source1",
"source2",
},
Columns: map[string]Column{
"LOL Name": {"LOLname", "YAYtype"},
},
},
},
Slices: map[string]Slice{
"whats_a_slice": Slice{
Table: "the_table",
Dimensions: []string{"LolName1"},
Metrics: []string{"LolName2"},
},
},
}
jsondata := definition.ToJson()
definition2 := NewDefinition()
definition2.FromJson(jsondata)
jsondata2 := definition2.ToJson()
os.Stdout.Write(jsondata)
if !bytes.Equal(jsondata, jsondata2) {
t.Errorf("FromJson or ToJson not bit accurate")
}
}