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("#")) }
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) }
func TestGetCellValue(t *testing.T) { mtest.RegTest(t) fn := "testdata/demo.xlsx" in := GetCellValue(fn, "Sheet1", "A1", "") //println(in) mtest.AssertEqual(in, "ID") }
func TestXXX(t *testing.T) { m := Model{} m.Id = "1" m.Email = "*****@*****.**" mtest.RegTest(t) mtest.AssertEqual(true, true) PrintValidate(m) }
func TestTrimBeginIndex(t *testing.T) { mtest.RegTest(t) mtest.AssertEqual(String("a/b/c.txt").TrimBeginIndex("/"), "b/c.txt") }
func TestTrimEndIndex(t *testing.T) { mtest.RegTest(t) mtest.AssertEqual(String("/a/b/c.txt").TrimEndIndex("/"), "/a/b") }
func TestGetMapKeys(t *testing.T) { InitMap() // order may not equal. mtest.AssertEqual(len(GetMapKeys(m)), 3) }
func TestAppConf(t *testing.T) { mtest.RegTest(t) mtest.AssertEqual(false, NewDefaultAppConf("none").IsExist()) mtest.AssertEqual(dbcConf.GetVendorName(), "Mabetle") }
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) }
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") }
func TestIsContain(t *testing.T) { mtest.RegTest(t) mtest.AssertEqual(true, skv.IsContain("a")) mtest.AssertEqual(true, skv.GetBool("c")) }
// DemoDemo > demo_demo func TestToTableName(t *testing.T) { mtest.RegTest(t) mtest.AssertEqual("demo_demo", ToTableName("DemoDemo")) }
func TestToCamel(t *testing.T) { mtest.RegTest(t) mtest.AssertEqual("DemoDemo", ToCamel("demo_demo")) }
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")) }
func TestPlainEncode(t *testing.T) { mtest.RegTest(t) mtest.AssertEqual(plain.Encode("demo"), "demo") }