Example #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("#"))
}
Example #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)
}
Example #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")
}
Example #4
0
func TestXXX(t *testing.T) {
	m := Model{}
	m.Id = "1"
	m.Email = "*****@*****.**"
	mtest.RegTest(t)
	mtest.AssertEqual(true, true)
	PrintValidate(m)
}
Example #5
0
func TestTrimBeginIndex(t *testing.T) {
	mtest.RegTest(t)

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

	mtest.AssertEqual(String("/a/b/c.txt").TrimEndIndex("/"), "/a/b")
}
Example #7
0
func TestGetMapKeys(t *testing.T) {
	InitMap()
	// order may not equal.
	mtest.AssertEqual(len(GetMapKeys(m)), 3)
}
Example #8
0
func TestAppConf(t *testing.T) {
	mtest.RegTest(t)
	mtest.AssertEqual(false, NewDefaultAppConf("none").IsExist())
	mtest.AssertEqual(dbcConf.GetVendorName(), "Mabetle")
}
Example #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)
}
Example #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")
}
Example #11
0
func TestIsContain(t *testing.T) {
	mtest.RegTest(t)
	mtest.AssertEqual(true, skv.IsContain("a"))
	mtest.AssertEqual(true, skv.GetBool("c"))
}
Example #12
0
// DemoDemo  > demo_demo
func TestToTableName(t *testing.T) {
	mtest.RegTest(t)
	mtest.AssertEqual("demo_demo", ToTableName("DemoDemo"))
}
Example #13
0
func TestToCamel(t *testing.T) {
	mtest.RegTest(t)
	mtest.AssertEqual("DemoDemo", ToCamel("demo_demo"))
}
Example #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"))
}
Example #15
0
func TestPlainEncode(t *testing.T) {
	mtest.RegTest(t)
	mtest.AssertEqual(plain.Encode("demo"), "demo")
}