summaryrefslogtreecommitdiff
path: root/internal/cli/cli_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/cli/cli_test.go')
-rw-r--r--internal/cli/cli_test.go29
1 files changed, 29 insertions, 0 deletions
diff --git a/internal/cli/cli_test.go b/internal/cli/cli_test.go
index 374d723..58b2d00 100644
--- a/internal/cli/cli_test.go
+++ b/internal/cli/cli_test.go
@@ -353,6 +353,35 @@ func TestRefCompare(t *testing.T) {
}
}
+func TestRandVerse(t *testing.T) {
+ // Random content varies, but structure/exit codes are deterministic.
+ var out, errb bytes.Buffer
+ if code := Run([]string{"--rand-v", "-b", "vul"}, nil, &out, &errb); code != 0 {
+ t.Fatalf("rand-v code=%d stderr=%q", code, errb.String())
+ }
+ // en dialect (default config): the reference line carries a colon.
+ if s := out.String(); strings.TrimSpace(s) == "" || !strings.Contains(s, ":") {
+ t.Errorf("rand-v output = %q", s)
+ }
+}
+
+func TestRandChapter(t *testing.T) {
+ var out, errb bytes.Buffer
+ if code := Run([]string{"--rand-ch", "-b", "wuj"}, nil, &out, &errb); code != 0 {
+ t.Fatalf("rand-ch code=%d stderr=%q", code, errb.String())
+ }
+ if strings.TrimSpace(out.String()) == "" {
+ t.Errorf("rand-ch produced no output")
+ }
+}
+
+func TestRandRejectsBT(t *testing.T) {
+ var out, errb bytes.Buffer
+ if code := Run([]string{"--rand-v", "-b", "bt"}, nil, &out, &errb); code != 2 {
+ t.Errorf("rand -b bt code=%d want 2 (stderr=%q)", code, errb.String())
+ }
+}
+
func TestGospelCitationHelpers(t *testing.T) {
secs := []liturgy.Section{
{Heading: "1. czytanie (Iz 1, 1)", PartID: "pierwsze_czytanie"},