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

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

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