Example #1
0
func TestGetContent(t *testing.T) {
	revision.SetDir("../pan-wvc-2010/revisions")

	exp := "#REDIRECT [[Cyclops (Clive Cussler novel)]]\r\n\r\n"
	got, e := revision.GetContent("98619235")

	if e != nil {
		t.Fatal(e)
	}

	assert(t, exp, got, true)
}
Example #2
0
/*
doDiff read old and new revisions from edit and compare both of them to get
deletions in old rev and additions in new rev.

Deletions and additions then combined into one string and appended to dataset.
*/
func doDiff(readset dsv.ReaderInterface, ds tabula.DatasetInterface) {
	oldids := ds.GetColumnByName("oldrevisionid").ToStringSlice()
	newids := ds.GetColumnByName("newrevisionid").ToStringSlice()

	revision.SetDir(dRevisions)

	diffset, e := revision.Diff(oldids, newids, ".txt")
	if e != nil {
		panic(e)
	}

	// Create input metadata for diff
	md := dsv.NewMetadata("deletions", "string", ",", "\"", "\"", nil)
	readset.AddInputMetadata(md)

	md = dsv.NewMetadata("additions", "string", ",", "\"", "\"", nil)
	readset.AddInputMetadata(md)

	ds.MergeColumns(diffset)
}
Example #3
0
/*
initReader set configuration of generator.
*/
func initReader(reader *wvcgen.Reader) {
	revision.SetDir(reader.RevisionDir)
	revision.SetCleanDir(reader.RevisionCleanDir)
}