• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Golang testhelpers.AssertString函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Golang中github.com/rjkroege/wikitools/testhelpers.AssertString函数的典型用法代码示例。如果您正苦于以下问题:Golang AssertString函数的具体用法?Golang AssertString怎么用?Golang AssertString使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了AssertString函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。

示例1: Test_Dropcrnl

func Test_Dropcrnl(t *testing.T) {
	testhelpers.AssertString(t, "", string(Dropcrnl([]byte(""))))
	testhelpers.AssertString(t, "h", string(Dropcrnl([]byte("h"))))
	testhelpers.AssertString(t, "hello", string(Dropcrnl([]byte("hello"))))
	testhelpers.AssertString(t, "hello\nthere", string(Dropcrnl([]byte("hello\r\nthere"))))
	testhelpers.AssertString(t, "hello\nthere", string(Dropcrnl([]byte("hello\nthere"))))
}
开发者ID:rjkroege,项目名称:winmux,代码行数:7,代码来源:dropcrnl_test.go


示例2: Test_Runemodulus

func Test_Runemodulus(t *testing.T) {

	b, r := Runemodulus([]byte("abcd"))
	testhelpers.AssertString(t, "abcd", string(b))
	testhelpers.AssertInt(t, 0, len(r))

	// 日本語  <- 3 Asian letters.
	s := "\xe6\x97\xa5\xe6\x9c\xac\xe8\xaa\x9e"
	sb := []byte(s)

	b, r = Runemodulus(sb)
	testhelpers.AssertString(t, s, string(b))
	testhelpers.AssertInt(t, 0, len(r))

	b, r = Runemodulus(sb[:len(sb)-1])
	testhelpers.AssertString(t, s[0:6], string(b))
	testhelpers.AssertInt(t, 2, len(r))
	testhelpers.AssertInt(t, int(int(r[0])), '\xe8')
	testhelpers.AssertInt(t, int(int(r[1])), '\xaa')

	b, r = Runemodulus(sb[:len(sb)-2])
	testhelpers.AssertInt(t, 1, len(r))
	testhelpers.AssertString(t, s[0:6], string(b))
	testhelpers.AssertInt(t, int(r[0]), '\xe8')

}
开发者ID:rjkroege,项目名称:winmux,代码行数:26,代码来源:partialrune_test.go


示例3: Test_VerifyRequiredFields_inbook_editor

func Test_VerifyRequiredFields_inbook_editor(t *testing.T) {
	err := VerifyRequiredFields("inbook", []string{"bibkey", "author", "title", "chapter", "publisher", "year"})
	if err != nil {
		t.Error("wrongly claim that valid author/chapter inbook keys are invalid: " + err.Error())
	}

	err = VerifyRequiredFields("inbook", []string{"bibkey", "editor", "title", "chapter", "publisher", "year"})
	if err != nil {
		t.Error("wrongly claim that valid editor/chapter inbook keys are invalid: " + err.Error())
	}

	err = VerifyRequiredFields("inbook", []string{"bibkey", "author", "title", "pages", "publisher", "year"})
	if err != nil {
		t.Error("wrongly claim that valid author/pages inbook keys are invalid: " + err.Error())
	}

	err = VerifyRequiredFields("inbook", []string{"bibkey", "editor", "title", "pages", "publisher", "year"})
	if err != nil {
		t.Error("wrongly claim that valid editor/pages inbook keys are invalid: " + err.Error())
	}

	err = VerifyRequiredFields("inbook", []string{"bibkey", "editor", "title", "publisher", "year"})
	if err == nil {
		t.Error("for editor inbook, wrongly claim missing both pages and chapter is correct")
	} else {
		testhelpers.AssertString(t, "Missing required fields: chapter pages for entry type inbook", err.Error())
	}

	err = VerifyRequiredFields("inbook", []string{"bibkey", "author", "title", "publisher", "year"})
	if err == nil {
		t.Error("for author inbook, wrongly claim missing both pages and chapter is correct")
	} else {
		testhelpers.AssertString(t, "Missing required fields: chapter pages for entry type inbook", err.Error())
	}
}
开发者ID:rjkroege,项目名称:wikitools,代码行数:35,代码来源:build_test.go


示例4: Test_UniqueValidName

func Test_UniqueValidName(t *testing.T) {
	realisticdate, _ := article.ParseDateUnix("1999/03/21 17:00:00")

	nd := &MockSystem{false, time.Time{}}
	testhelpers.AssertString(t, "hello/there.md", UniqueValidName("hello/", "there", ".md", nd))

	nd = &MockSystem{true, realisticdate}
	testhelpers.AssertString(t, "hello/there-19990321-170000.md", UniqueValidName("hello/", "there", ".md", nd))
}
开发者ID:rjkroege,项目名称:wikitools,代码行数:9,代码来源:filter_test.go


示例5: Test_Delete_spanning_offset

func Test_Delete_spanning_offset(t *testing.T) {
	ws := New()
	ws.Move(2)
	ws.Addtyping([]byte{'a', 'b', 'c'}, 2)
	testhelpers.AssertString(t, "abc", ws.String())

	n := ws.Delete(1, 3)
	testhelpers.AssertString(t, "bc", ws.String())
	testhelpers.AssertInt(t, 1, n)
}
开发者ID:rjkroege,项目名称:winmux,代码行数:10,代码来源:winslice_test.go


示例6: Test_ExtraKeysString

func Test_ExtraKeysString(t *testing.T) {
	m := MetaData{"", never, never, "", false, []string{}, map[string]string{"a": "b"}}
	testhelpers.AssertString(t, "a:b", m.ExtraKeysString())

	m = MetaData{"", never, never, "", false, []string{}, map[string]string{"a": "b", "c": "d"}}
	testhelpers.AssertString(t, "a:b, c:d", m.ExtraKeysString())

	m = MetaData{"", never, never, "", false, []string{}, map[string]string{"c": "d", "a": "b"}}
	testhelpers.AssertString(t, "a:b, c:d", m.ExtraKeysString())
}
开发者ID:rjkroege,项目名称:wikitools,代码行数:10,代码来源:metadata_test.go


示例7: Test_PrettyDate

func Test_PrettyDate(t *testing.T) {
	statdate, _ := ParseDateUnix("1999/03/21 17:00:00")
	tagdate, _ := ParseDateUnix("2012/03/19 06:51:15")

	md := MetaData{"", statdate, never, "What I want 0", false, []string{}, map[string]string{}}
	testhelpers.AssertString(t, "Sunday, Mar 21, 1999", md.PrettyDate())

	md = MetaData{"", statdate, tagdate, "What I want 0", true, []string{}, map[string]string{}}
	testhelpers.AssertString(t, "Monday, Mar 19, 2012", md.PrettyDate())
}
开发者ID:rjkroege,项目名称:wikitools,代码行数:10,代码来源:metadata_test.go


示例8: Test_Delete_multi

func Test_Delete_multi(t *testing.T) {
	ws := New()
	ws.Move(2)
	ws.Addtyping([]byte{'a', 'b', 'c'}, 2)
	testhelpers.AssertString(t, "abc", ws.String())

	n := ws.Delete(3, 5)
	testhelpers.AssertString(t, "a", ws.String())
	testhelpers.AssertInt(t, 0, n)
}
开发者ID:rjkroege,项目名称:winmux,代码行数:10,代码来源:winslice_test.go


示例9: Test_Sendtype

func Test_Sendtype(t *testing.T) {
	mock := &mockttyfd{make([][]byte, 0, 10)}
	tp := New(mock, Makecho())

	tp.addtype([]byte("hello\nbye"), 0, false)
	tp.Sendtype()

	testhelpers.AssertInt(t, 1, len(mock.writes))
	testhelpers.AssertString(t, "hello\n", string(mock.writes[0]))
	testhelpers.AssertString(t, "bye", string(tp.Typing))
}
开发者ID:rjkroege,项目名称:winmux,代码行数:11,代码来源:pair_test.go


示例10: Test_TypeCook

func Test_TypeCook(t *testing.T) {
	mock := &mockttyfd{make([][]byte, 0, 10)}
	tp := New(mock, Makecho())

	s := "hello\n"
	e := &acme.Event{Nr: len(s), Text: []byte(s)}
	tp.Type(e)

	testhelpers.AssertInt(t, 1, len(mock.writes))
	testhelpers.AssertString(t, "hello\n", string(mock.writes[0]))
	testhelpers.AssertString(t, "", string(tp.Typing))
	testhelpers.AssertBool(t, true, tp.cook)
}
开发者ID:rjkroege,项目名称:winmux,代码行数:13,代码来源:pair_test.go


示例11: Test_Cancel_Wholeword

func Test_Cancel_Wholeword(t *testing.T) {
	echo := Makecho()
	echo.echoed([]byte("hello"))

	s := []byte("h")
	r := echo.Cancel(s)
	testhelpers.AssertInt(t, 0, len(r))
	testhelpers.AssertString(t, "ello", string(echo.oldest))

	s = []byte("e")
	r = echo.Cancel(s)
	testhelpers.AssertInt(t, 0, len(r))
	testhelpers.AssertString(t, "llo", string(echo.oldest))
}
开发者ID:rjkroege,项目名称:winmux,代码行数:14,代码来源:decho_test.go


示例12: Test_ExploreTemplating

func Test_ExploreTemplating(t *testing.T) {
	s, e := CreateBibTexEntry([]string{"@book"}, map[string]string{"bib-bibkey": "jones2013", "bib-editor": "Peyton Jones", "bib-title": "Collected Angst", "bib-publisher": "Penguin", "bib-year": "2013"})
	if e != nil {
		t.Error("CreateBibTexEntry wrongly failed with: " + e.Error())
	}
	testhelpers.AssertString(t, output1, s)

	s, e = CreateBibTexEntry([]string{"@book", "@bibtex-article"}, map[string]string{"bib-bibkey": "jones2013", "bib-editor": "Peyton Jones", "bib-title": "Collected Angst", "bib-publisher": "Penguin", "bib-year": "2013"})
	if e == nil {
		t.Error("CreateBibTexEntry wrongly succeeded")
	} else {
		testhelpers.AssertString(t, "", s)
		testhelpers.AssertString(t, "Missing required fields: author journal for entry type article", e.Error())
	}
}
开发者ID:rjkroege,项目名称:wikitools,代码行数:15,代码来源:build_test.go


示例13: Test_addtype

func Test_addtype(t *testing.T) {
	tp := New(new(mockttyfd), Makecho())

	tp.addtype([]byte("hello"), 0, false)
	testhelpers.AssertString(t, "hello", tp.String())

	// addtype is doing the wrong thing...
	tp.addtype([]byte{3}, len("hello"), false)
	testhelpers.AssertString(t, "hello", tp.String())

	// addtype is doing the wrong thing...
	tp.addtype([]byte{3}, len("hello_"), true)
	testhelpers.AssertString(t, "", tp.String())

}
开发者ID:rjkroege,项目名称:winmux,代码行数:15,代码来源:pair_test.go


示例14: Test_Labelcommand_hasend_with_space

func Test_Labelcommand_hasend_with_space(t *testing.T) {
	b, r := Labelcommand([]byte("hel\007lo"))
	if r != nil {
		t.Error("incomplete command should have no label")
	}
	testhelpers.AssertString(t, "hel\007lo", string(b))
}
开发者ID:rjkroege,项目名称:winmux,代码行数:7,代码来源:labelcommand_test.go


示例15: Test_Delete_before_offset

func Test_Delete_before_offset(t *testing.T) {
	ws := New()
	ws.Move(2)

	n := ws.Delete(1, 2)
	testhelpers.AssertString(t, "", ws.String())
	testhelpers.AssertInt(t, 1, n)
}
开发者ID:rjkroege,项目名称:winmux,代码行数:8,代码来源:winslice_test.go


示例16: Test_Reset

func Test_Reset(t *testing.T) {
	ws := New()
	ws.Move(2)
	ws.Addtyping([]byte{'b'}, 2)

	ws.Reset()
	testhelpers.AssertString(t, "", ws.String())
}
开发者ID:rjkroege,项目名称:winmux,代码行数:8,代码来源:winslice_test.go


示例17: Test_Delete_panic

func Test_Delete_panic(t *testing.T) {
	ws := New()
	ws.Move(2)
	ws.Addtyping([]byte{'a', 'b', 'c'}, 2)
	testhelpers.AssertString(t, "abc", ws.String())

	defer func() {
		if e := recover(); e != nil {
			s := e.(string)
			testhelpers.AssertString(t, "Delete went wrong", s)
		} else {
			t.Fail()
		}
	}()

	ws.Delete(5, 6)
}
开发者ID:rjkroege,项目名称:winmux,代码行数:17,代码来源:winslice_test.go


示例18: Test_Cancel_Terminating_NL_Not_Cancelled

func Test_Cancel_Terminating_NL_Not_Cancelled(t *testing.T) {
	echo := Makecho()
	echo.echoed([]byte("ls\n"))

	s := []byte("ls\r\n")
	r := echo.Cancel(s)
	testhelpers.AssertString(t, "", string(r))
}
开发者ID:rjkroege,项目名称:winmux,代码行数:8,代码来源:decho_test.go


示例19: Test_Delete_to_empty

func Test_Delete_to_empty(t *testing.T) {
	ws := New()
	ws.Move(2)
	ws.Addtyping([]byte{'a'}, 2)

	n := ws.Delete(2, 3)
	testhelpers.AssertString(t, "", ws.String())
	testhelpers.AssertInt(t, 0, n)
}
开发者ID:rjkroege,项目名称:winmux,代码行数:9,代码来源:winslice_test.go


示例20: Test_Type

func Test_Type(t *testing.T) {
	mock := &mockttyfd{make([][]byte, 0, 10)}
	tp := New(mock, Makecho())

	e := &acme.Event{Nr: len("hello"), Text: []byte("hello")}
	tp.Type(e)

	testhelpers.AssertString(t, "hello", string(tp.Typing))
}
开发者ID:rjkroege,项目名称:winmux,代码行数:9,代码来源:pair_test.go



注:本文中的github.com/rjkroege/wikitools/testhelpers.AssertString函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Golang aws.String函数代码示例发布时间:2022-05-28
下一篇:
Golang notify.Watch函数代码示例发布时间:2022-05-28
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap