Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
e91fbdde77 |
|||
|
886cbd7b32 |
2 changed files with 33 additions and 7 deletions
|
|
@ -518,10 +518,18 @@ func (v *VerseSet) String() string {
|
|||
sb.WriteByte('\n')
|
||||
sb.WriteString(strings.Repeat(" ", 4*verse.PoemOffset))
|
||||
}
|
||||
|
||||
sb.WriteString(verse.Text)
|
||||
if lastOffset != verse.PoemOffset {
|
||||
if lastOffset > 0 && verse.PoemOffset == 0 {
|
||||
if v.SkipLineBreaks {
|
||||
sb.WriteByte(' ')
|
||||
} else {
|
||||
sb.WriteByte('\n')
|
||||
}
|
||||
}
|
||||
lastOffset = verse.PoemOffset
|
||||
}
|
||||
sb.WriteString(verse.Text)
|
||||
if i == 0 && len(v.Verses) > 1 {
|
||||
sb.WriteByte(' ')
|
||||
continue
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@ const (
|
|||
Jude6 string = `And the angels who did not stay within their own domain but abandoned their proper dwelling—these He has kept in eternal chains under darkness, bound for judgment on that great day.`
|
||||
Obadiah5 string = `“If thieves came to you, if robbers by night—oh, how you will be ruined—would they not steal only what they wanted? If grape gatherers came to you, would they not leave some gleanings?`
|
||||
Psa32_4 string = `For day and night Your hand was heavy upon me; my strength was drained as in the summer heat. Selah`
|
||||
Psa51_10_12 string = `Create in me a clean heart, O God, and renew a right spirit within me. Cast me not away from Your presence; take not your Holy Spirit from me. Restore to me the joy of Your salvation, and sustain me with a willing spirit.`
|
||||
John1_4_6 string = `In Him was life, and that life was the light of men. The Light shines in the darkness, and the darkness has not overcome it. There came a man who was sent from God. His name was John.`
|
||||
)
|
||||
|
||||
|
|
@ -124,6 +125,23 @@ func Test_ChapterJSON(t *testing.T) {
|
|||
t.Error(" should be ->", John1_4_6)
|
||||
}
|
||||
|
||||
testJSON = &bytes.Buffer{}
|
||||
testJSON.WriteString(`{"numberOfVerses": 19, "chapter": {"number": 51, "content": [{"type": "verse", "number": 10, "content": [{"text": "Create in me a clean heart, O God,", "poem": 1}, {"text": "and renew a right spirit within me.", "poem": 2}]}, {"type": "verse", "number": 11, "content": [{"text": "Cast me not away from Your presence;", "poem": 1}, {"text": "take not Your Holy Spirit from me.", "poem": 2}]}, {"type": "verse", "number": 12, "content": [{"text": "Restore to me the joy of Your salvation,", "poem": 1}, {"text": "and sustain me with a willing spirit.", "poem": 2}]}]}}`)
|
||||
|
||||
c = &bible.Chapter{}
|
||||
if err := json.Unmarshal(testJSON.Bytes(), c); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
vv = c.FilterVerses(10, 12)
|
||||
vv.SkipLineBreaks = true
|
||||
if vv.String() != Psa51_10_12 {
|
||||
t.Error("Psalm 51:10-12 did not match as expected:")
|
||||
t.Error(vv.String())
|
||||
t.Error("Should be ->")
|
||||
t.Error(Psa51_10_12)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func Test_VerseFilter(t *testing.T) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue