From 4b6d44e1214f1059da3c697b3952ec15e11c8dce Mon Sep 17 00:00:00 2001 From: Ryan Geary Date: Tue, 10 Sep 2019 23:36:39 -0400 Subject: [PATCH] Add basic test suite --- test/choose_0:2.txt | 6 ++++++ test/choose_0_3.txt | 6 ++++++ test/choose_9.txt | 6 ++++++ test/choose_9_3.txt | 6 ++++++ test/choose_:2.txt | 6 ++++++ test/lorem.txt | 6 ++++++ test/test.sh | 13 +++++++++++++ 7 files changed, 49 insertions(+) create mode 100644 test/choose_0:2.txt create mode 100644 test/choose_0_3.txt create mode 100644 test/choose_9.txt create mode 100644 test/choose_9_3.txt create mode 100644 test/choose_:2.txt create mode 100644 test/lorem.txt create mode 100755 test/test.sh diff --git a/test/choose_0:2.txt b/test/choose_0:2.txt new file mode 100644 index 0000000..38b492a --- /dev/null +++ b/test/choose_0:2.txt @@ -0,0 +1,6 @@ +Lorem ipsum +incididunt ut +nostrud exercitation +Duis aute +fugiat nulla +culpa qui diff --git a/test/choose_0_3.txt b/test/choose_0_3.txt new file mode 100644 index 0000000..87dd3c5 --- /dev/null +++ b/test/choose_0_3.txt @@ -0,0 +1,6 @@ +Lorem sit +incididunt et +nostrud laboris +Duis dolor +fugiat Excepteur +culpa deserunt diff --git a/test/choose_9.txt b/test/choose_9.txt new file mode 100644 index 0000000..dbc3782 --- /dev/null +++ b/test/choose_9.txt @@ -0,0 +1,6 @@ +do +ad +commodo +esse +sunt + diff --git a/test/choose_9_3.txt b/test/choose_9_3.txt new file mode 100644 index 0000000..05b039f --- /dev/null +++ b/test/choose_9_3.txt @@ -0,0 +1,6 @@ +do sit +ad et +commodo laboris +esse dolor +sunt Excepteur + deserunt diff --git a/test/choose_:2.txt b/test/choose_:2.txt new file mode 100644 index 0000000..38b492a --- /dev/null +++ b/test/choose_:2.txt @@ -0,0 +1,6 @@ +Lorem ipsum +incididunt ut +nostrud exercitation +Duis aute +fugiat nulla +culpa qui diff --git a/test/lorem.txt b/test/lorem.txt new file mode 100644 index 0000000..7b95d6b --- /dev/null +++ b/test/lorem.txt @@ -0,0 +1,6 @@ +Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor +incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis +nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. +Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu +fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in +culpa qui officia deserunt mollit anim id est laborum. diff --git a/test/test.sh b/test/test.sh new file mode 100755 index 0000000..f1d438a --- /dev/null +++ b/test/test.sh @@ -0,0 +1,13 @@ +#!/bin/bash +set -e + +test_dir="test" +orig_dir="$(pwd)" +cd "$(git rev-parse --show-toplevel)" +cargo build + +diff -Z <(cargo run -- 0:2 -i ${test_dir}/lorem.txt) <(cat "${test_dir}/choose_0:2.txt") +diff -Z <(cargo run -- 0 3 -i ${test_dir}/lorem.txt) <(cat "${test_dir}/choose_0_3.txt") +diff -Z <(cargo run -- :2 -i ${test_dir}/lorem.txt) <(cat "${test_dir}/choose_:2.txt") +diff -Z <(cargo run -- 9 3 -i ${test_dir}/lorem.txt) <(cat "${test_dir}/choose_9_3.txt") +diff -Z <(cargo run -- 9 -i ${test_dir}/lorem.txt) <(cat "${test_dir}/choose_9.txt")