示例#1
0
func _TestThrEntryToTestVisitor(t testThrEntry) xmlutils.TestVisitor {
	customError := xmlutils.NewErrorChecker(xmlutils.DisableAllError)

	customError.EnableErrorChecking("in-reply-to", atom.MissingAttribute)
	customError.EnableErrorChecking("in-reply-to", atom.AttributeDuplicated)
	customError.EnableErrorChecking("entry", atom.AttributeDuplicated)
	customError.EnableErrorChecking("link", LinkNotReplies)
	customError.EnableErrorChecking("link", NotInLinkElement)
	customError.EnableErrorChecking(xmlutils.AllError, atom.NotPositiveNumber)

	testVisitor := xmlutils.TestVisitor{
		XML:                t.XML,
		ExpectedError:      nil,
		ExpectedVisitor:    t.ExpectedThrEntry,
		VisitorConstructor: testThrEntryConstructor,
		Validator:          testThrEntryValidator,
		CustomError:        &customError,
	}

	if t.ExpectedError != nil {
		testVisitor.ExpectedError = t.ExpectedError
	}

	return testVisitor
}
示例#2
0
func testGeneratorToTestVisitor(t testGenerator) xmlutils.TestVisitor {
	testVisitor := xmlutils.TestVisitor{
		XML:                t.XML,
		ExpectedError:      nil,
		ExpectedVisitor:    t.ExpectedGenerator,
		VisitorConstructor: testGeneratorConstructor,
		Validator:          testGeneratorValidator,
	}

	if t.ExpectedError != nil {
		testVisitor.ExpectedError = t.ExpectedError
	}

	return testVisitor
}
示例#3
0
func _TestCategoryToTestVisitor(t testCategory) xmlutils.TestVisitor {
	testVisitor := xmlutils.TestVisitor{
		XML:                t.XML,
		ExpectedError:      nil,
		ExpectedVisitor:    t.ExpectedCategory,
		VisitorConstructor: testCategoryConstructor,
		Validator:          testCategoryValidator,
	}

	if t.ExpectedError != nil {
		testVisitor.ExpectedError = t.ExpectedError
	}

	return testVisitor
}
示例#4
0
func _TestTextConstructToTestVisitor(t testTextConstruct) xmlutils.TestVisitor {
	testVisitor := xmlutils.TestVisitor{
		XML:                t.XML,
		ExpectedError:      nil,
		ExpectedVisitor:    t.ExpectedTextConstruct,
		VisitorConstructor: testTextConstructConstructor,
		Validator:          testTextConstructValidator,
	}

	if t.ExpectedError != nil {
		testVisitor.ExpectedError = t.ExpectedError
	}

	return testVisitor
}
示例#5
0
文件: logo_test.go 项目: apognu/xml
func testLogoToTestVisitor(t testLogo) xmlutils.TestVisitor {
	testVisitor := xmlutils.TestVisitor{
		XML:                t.XML,
		ExpectedError:      nil,
		ExpectedVisitor:    t.ExpectedLogo,
		VisitorConstructor: testLogoConstructor,
		Validator:          testLogoValidator,
	}

	if t.ExpectedError != nil {
		testVisitor.ExpectedError = t.ExpectedError
	}

	return testVisitor
}
示例#6
0
func _TestChannelToTestVisitor(t testChannel) xmlutils.TestVisitor {
	testVisitor := xmlutils.TestVisitor{
		XML:                t.XML,
		ExpectedError:      nil,
		ExpectedVisitor:    t.ExpectedChannel,
		VisitorConstructor: testChannelConstructor,
		Validator:          testChannelValidator,
	}

	if t.ExpectedError != nil {
		testVisitor.ExpectedError = t.ExpectedError
	}

	return testVisitor
}
示例#7
0
文件: source_test.go 项目: apognu/xml
func _TestSourceToTestVisitor(t testSource) xmlutils.TestVisitor {
	testVisitor := xmlutils.TestVisitor{
		XML:                t.XML,
		ExpectedError:      nil,
		ExpectedVisitor:    t.ExpectedSource,
		VisitorConstructor: testSourceConstructor,
		Validator:          testSourceValidator,
	}

	if t.ExpectedError != nil {
		testVisitor.ExpectedError = t.ExpectedError
	}

	return testVisitor
}
示例#8
0
文件: cloud_test.go 项目: apognu/xml
func _TestCloudToTestVisitor(t testCloud) xmlutils.TestVisitor {
	testVisitor := xmlutils.TestVisitor{
		XML:                t.XML,
		ExpectedError:      nil,
		ExpectedVisitor:    t.ExpectedCloud,
		VisitorConstructor: testCloudConstructor,
		Validator:          testCloudValidator,
	}

	if t.ExpectedError != nil {
		testVisitor.ExpectedError = t.ExpectedError
	}

	return testVisitor
}
示例#9
0
文件: item_test.go 项目: apognu/xml
func _TestItemToTestVisitor(t testItem) xmlutils.TestVisitor {
	testVisitor := xmlutils.TestVisitor{
		XML:                t.XML,
		ExpectedError:      nil,
		ExpectedVisitor:    t.ExpectedItem,
		VisitorConstructor: testItemConstructor,
		Validator:          testItemValidator,
	}

	if t.ExpectedError != nil {
		testVisitor.ExpectedError = t.ExpectedError
	}

	return testVisitor
}
示例#10
0
文件: icon_test.go 项目: apognu/xml
func testIconToTestVisitor(t testIcon) xmlutils.TestVisitor {
	testVisitor := xmlutils.TestVisitor{
		XML:                t.XML,
		ExpectedError:      nil,
		ExpectedVisitor:    t.ExpectedIcon,
		VisitorConstructor: testIconConstructor,
		Validator:          testIconValidator,
	}

	if t.ExpectedError != nil {
		testVisitor.ExpectedError = t.ExpectedError
	}

	return testVisitor
}