Example #1
0
func Test_ProjectsNotes(t *testing.T) {
	expected := `= Test.Project.A
== 2010-11-10 23:00:00
note note note` + "\n\n"

	expected += `= Test.Project.B
== 2010-11-10 23:00:00
note note note` + "\n\n"

	expected += `= Test.Project.C
== 2010-11-10 23:00:00
note note note` + "\n\n"

	expected += `= Test.Project.D
== 2010-11-10 23:00:00
note note note` + "\n\n"

	got := new(bytes.Buffer)

	projects := testhelper.GetTestProjects(1, 1, "A", "B", "C", "D")
	for _, project := range projects.List() {
		ProjectNotes(got, 0, &project)
	}

	testhelper.CompareGotExpected(t, nil, got.String(), expected)
}
Example #2
0
func Test_Todos(t *testing.T) {
	expected := `* todo todo todo` + "\n\n"

	got := new(bytes.Buffer)
	Todos(got, testhelper.GetTestProject("A", 1, 1).Todos())

	testhelper.CompareGotExpected(t, nil, got.String(), expected)
}
Example #3
0
func Test_Notes(t *testing.T) {
	expected := `== 2010-11-10 23:00:00
note note note` + "\n\n"

	got := new(bytes.Buffer)
	Notes(got, 2, testhelper.GetTestProject("A", 1, 1).Notes())

	testhelper.CompareGotExpected(t, nil, got.String(), expected)
}
Example #4
0
func Test_ProjectTodos(t *testing.T) {
	expected := `= Test.Project.A
* todo todo todo` + "\n\n"

	got := new(bytes.Buffer)
	project := testhelper.GetTestProject("A", 1, 1)
	ProjectTodos(got, 0, &project)

	testhelper.CompareGotExpected(t, nil, got.String(), expected)
}
Example #5
0
func Test_ProjectNoNotesNoTodos(t *testing.T) {
	expected := ``

	got := new(bytes.Buffer)

	project := testhelper.GetTestProject("A", 0, 0)
	Project(got, 0, &project)

	testhelper.CompareGotExpected(t, nil, got.String(), expected)
}
Example #6
0
func Test_ProjectMultiple(t *testing.T) {
	expected := `:toc: right
:toclevels: 4
:sectanchors:
:sectlink:
:icons: font
:linkattrs:
:numbered:
:idprefix:
:idseparator: -
:doctype: book
:source-highlighter: pygments
:listing-caption: Listing` + "\n\n"

	expected += "= Entries\n\n"

	expected += `== Test.Project.A
=== Todos
* todo todo todo

=== Notes
==== 2010-11-10 23:00:00
note note note` + "\n\n"

	expected += `== Test.Project.B
=== Todos
* todo todo todo

=== Notes
==== 2010-11-10 23:00:00
note note note` + "\n\n"

	expected += `== Test.Project.C
=== Todos
* todo todo todo

=== Notes
==== 2010-11-10 23:00:00
note note note` + "\n\n"

	expected += `== Test.Project.D
=== Todos
* todo todo todo

=== Notes
==== 2010-11-10 23:00:00
note note note` + "\n\n"

	got := new(bytes.Buffer)

	projects := testhelper.GetTestProjects(1, 1, "A", "B", "C", "D")
	Projects(got, "Entries", 0, &projects)

	testhelper.CompareGotExpected(t, nil, got.String(), expected)
}
Example #7
0
func Test_TodosDone(t *testing.T) {
	expected := ``

	got := new(bytes.Buffer)
	todos := testhelper.GetTestProject("A", 1, 1).Todos()
	todos[0].Active = false

	Todos(got, todos)

	testhelper.CompareGotExpected(t, nil, got.String(), expected)
}
Example #8
0
func Test_ProjectNotes(t *testing.T) {
	expected := `= Test.Project.A
== 2010-11-10 23:00:00
note note note` + "\n\n"

	got := new(bytes.Buffer)
	project := testhelper.GetTestProject("A", 1, 1)
	ProjectNotes(got, 0, &project)

	testhelper.CompareGotExpected(t, nil, got.String(), expected)
}
Example #9
0
func Test_HeaderIndent(t *testing.T) {
	tests := map[int]string{
		-1: "",
		0:  "",
		1:  "=",
		2:  "==",
		3:  "===",
		4:  "====",
		5:  "=====",
		6:  "======",
	}

	for input, expected := range tests {
		got := HeaderIndent(input)
		testhelper.CompareGotExpected(t, nil, got, expected)
	}
}
Example #10
0
func Test_NotesValue(t *testing.T) {
	expected := `== 2010-11-10 23:00:00
=== Header In Note Value
note note note

==== SubHeader In Note Value
note note note` + "\n\n"

	value := `= Header In Note Value
note note note

== SubHeader In Note Value
note note note`

	got := new(bytes.Buffer)

	project := testhelper.GetTestProject("A", 0, 0)
	project.AddNote(testhelper.GetTestNote(0, value))

	Notes(got, 2, project.Notes())

	testhelper.CompareGotExpected(t, nil, got.String(), expected)
}