commit 282df9321e7911285aa18673fdeb562298890b41
parent 3a571437c9af78cefad3d3b225accdfb38561eb3
Author: David Schlachter <t480-debian-git@schlachter.ca>
Date: Mon, 10 Nov 2025 00:24:57 -0500
Add simple test
Diffstat:
2 files changed, 23 insertions(+), 0 deletions(-)
diff --git a/main_test.go b/main_test.go
@@ -0,0 +1,18 @@
+package main
+
+import (
+ "testing"
+)
+
+func TestMain(t *testing.T) {
+ tasks, err := readInput("testdata/test_tasks.txt")
+ if err != nil {
+ t.Logf("Expected no error when reading input file, got '%s'", err)
+ t.FailNow()
+ }
+
+ if len(tasks) != 3 {
+ t.Logf("Expected 3 tasks to be parsed, got %d", len(tasks))
+ t.FailNow()
+ }
+}
diff --git a/testdata/test_tasks.txt b/testdata/test_tasks.txt
@@ -0,0 +1,5 @@
+# This is a comment
+0 18 * * Mon Take out garbage, recycling, compost
+30 8 * * Sun Water indoor plants
+
+0 10 * 4-10 * Water outdoor plants