summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--main_test.go18
-rw-r--r--testdata/test_tasks.txt5
2 files changed, 23 insertions, 0 deletions
diff --git a/main_test.go b/main_test.go
new file mode 100644
index 0000000..3e79bf9
--- /dev/null
+++ 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
new file mode 100644
index 0000000..f242539
--- /dev/null
+++ 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