mirror of
https://github.com/OpenDiablo2/OpenDiablo2
synced 2024-10-16 07:03:52 -04:00
32 lines
445 B
Go
32 lines
445 B
Go
package d2tbl
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"testing"
|
|
)
|
|
|
|
func exampleData() *TextDictionary {
|
|
result := &TextDictionary{
|
|
"abc": "def",
|
|
"someStr": "Some long string",
|
|
"lolstring": "lol",
|
|
}
|
|
|
|
return result
|
|
}
|
|
|
|
func TestTBL_Marshal(t *testing.T) {
|
|
tbl := exampleData()
|
|
data := tbl.Marshal()
|
|
newTbl, err := LoadTextDictionary(data)
|
|
if err != nil {
|
|
t.Error(err)
|
|
}
|
|
|
|
_, ok := newTbl["lolstring"]
|
|
if !ok {
|
|
t.Fatal("no string found")
|
|
}
|
|
}
|