Esempio n. 1
0
func TestSepEnd(t *testing.T) {
	mtest.RegTest(t)
	mtest.AssertEqual("def", String("/aaa/abc.def").SepEnd("."))
	mtest.AssertEqual("def", String("/aaa/abc/def").SepEnd("/"))
	mtest.AssertEqual("def", String("/aaa/abc\\def").SepEnd("\\"))
	mtest.AssertEqual("def", String("/aaa/abc@def").SepEnd("@"))
	mtest.AssertEqual("", String("/aaa/abc@def").SepEnd("#"))
}
Esempio n. 2
0
func TestKeyValueConfig(t *testing.T) {
	mtest.RegTest(t)
	c := NewConfig(&TestLoader{})

	mtest.AssertEqual(true, c.IsContain("a"))
	mtest.AssertEqual("a", c.GetString("a"))
	mtest.AssertEqual(false, c.GetBool("b"))
	mtest.AssertEqual(c.GetInt("c"), 5)
}
Esempio n. 3
0
func TestGetCellValue(t *testing.T) {
	mtest.RegTest(t)
	fn := "testdata/demo.xlsx"
	in := GetCellValue(fn, "Sheet1", "A1", "")
	//println(in)
	mtest.AssertEqual(in, "ID")
}
Esempio n. 4
0
func TestXXX(t *testing.T) {
	m := Model{}
	m.Id = "1"
	m.Email = "*****@*****.**"
	mtest.RegTest(t)
	mtest.AssertEqual(true, true)
	PrintValidate(m)
}
Esempio n. 5
0
func TestTrimBeginIndex(t *testing.T) {
	mtest.RegTest(t)

	mtest.AssertEqual(String("a/b/c.txt").TrimBeginIndex("/"), "b/c.txt")
}
Esempio n. 6
0
func TestTrimEndIndex(t *testing.T) {
	mtest.RegTest(t)

	mtest.AssertEqual(String("/a/b/c.txt").TrimEndIndex("/"), "/a/b")
}
Esempio n. 7
0
func TestGetMapKeys(t *testing.T) {
	InitMap()
	// order may not equal.
	mtest.AssertEqual(len(GetMapKeys(m)), 3)
}
Esempio n. 8
0
func TestAppConf(t *testing.T) {
	mtest.RegTest(t)
	mtest.AssertEqual(false, NewDefaultAppConf("none").IsExist())
	mtest.AssertEqual(dbcConf.GetVendorName(), "Mabetle")
}
Esempio n. 9
0
func TestGetLetterIndex(t *testing.T) {
	mtest.RegTest(t)
	mtest.AssertEqual(GetLetterIndex("a"), 0)
	mtest.AssertEqual(GetLetterIndex("aa"), 26)
	mtest.AssertEqual(GetLetterIndex("zz"), 25+26*26)
}
Esempio n. 10
0
func TestGetRowColIndex(t *testing.T) {
	mtest.RegTest(t)
	row, col := GetRowColIndex("AA23")
	mtest.AssertEqual(col, 26, "AA23 row should be 26")
	mtest.AssertEqual(row, 22, "AA23 col should be 22")
}
Esempio n. 11
0
func TestIsContain(t *testing.T) {
	mtest.RegTest(t)
	mtest.AssertEqual(true, skv.IsContain("a"))
	mtest.AssertEqual(true, skv.GetBool("c"))
}
Esempio n. 12
0
// DemoDemo  > demo_demo
func TestToTableName(t *testing.T) {
	mtest.RegTest(t)
	mtest.AssertEqual("demo_demo", ToTableName("DemoDemo"))
}
Esempio n. 13
0
func TestToCamel(t *testing.T) {
	mtest.RegTest(t)
	mtest.AssertEqual("DemoDemo", ToCamel("demo_demo"))
}
Esempio n. 14
0
func TestGetLocation(t *testing.T) {
	mtest.RegTest(t)
	mtest.AssertEqual("abc/def.go", GetLocation("abc", "def.go"))
	mtest.AssertEqual("abc/def.go", GetLocation("abc/", "def.go"))
}
Esempio n. 15
0
func TestPlainEncode(t *testing.T) {
	mtest.RegTest(t)
	mtest.AssertEqual(plain.Encode("demo"), "demo")
}