From 7c9108c9b99f53fad7a56f0d2a3d3c1bbbad5906 Mon Sep 17 00:00:00 2001 From: eplanet Date: Mon, 14 Nov 2016 20:58:58 +0000 Subject: [PATCH 1/3] Added unit test case for CPU temperature --- testcases/002-cpu-temp/expected_output.txt | 1 + testcases/002-cpu-temp/i3status.conf | 10 ++++++++++ testcases/002-cpu-temp/temp1_input | 1 + 3 files changed, 12 insertions(+) create mode 100644 testcases/002-cpu-temp/expected_output.txt create mode 100644 testcases/002-cpu-temp/i3status.conf create mode 100644 testcases/002-cpu-temp/temp1_input diff --git a/testcases/002-cpu-temp/expected_output.txt b/testcases/002-cpu-temp/expected_output.txt new file mode 100644 index 0000000..e46afa8 --- /dev/null +++ b/testcases/002-cpu-temp/expected_output.txt @@ -0,0 +1 @@ +T: 42 °C diff --git a/testcases/002-cpu-temp/i3status.conf b/testcases/002-cpu-temp/i3status.conf new file mode 100644 index 0000000..d83b32d --- /dev/null +++ b/testcases/002-cpu-temp/i3status.conf @@ -0,0 +1,10 @@ +general { + output_format = "none" +} + +order = "cpu_temperature 0" + +cpu_temperature 0 { + format = "T: %degrees °C" + path = "testcases/002-cpu-temp/temp1_input" +} diff --git a/testcases/002-cpu-temp/temp1_input b/testcases/002-cpu-temp/temp1_input new file mode 100644 index 0000000..6096bd1 --- /dev/null +++ b/testcases/002-cpu-temp/temp1_input @@ -0,0 +1 @@ +42000 From 243d08e1adc48898b3fb53484f00b68978fd685b Mon Sep 17 00:00:00 2001 From: eplanet Date: Mon, 14 Nov 2016 21:24:16 +0000 Subject: [PATCH 2/3] Added unit test case for path_exists --- testcases/003-path-exists/expected_output.txt | 1 + testcases/003-path-exists/i3status.conf | 14 ++++++++++++++ 2 files changed, 15 insertions(+) create mode 100644 testcases/003-path-exists/expected_output.txt create mode 100644 testcases/003-path-exists/i3status.conf diff --git a/testcases/003-path-exists/expected_output.txt b/testcases/003-path-exists/expected_output.txt new file mode 100644 index 0000000..3dbe379 --- /dev/null +++ b/testcases/003-path-exists/expected_output.txt @@ -0,0 +1 @@ +EXISTING: yes | NONEXISTANT: no diff --git a/testcases/003-path-exists/i3status.conf b/testcases/003-path-exists/i3status.conf new file mode 100644 index 0000000..38ca7d4 --- /dev/null +++ b/testcases/003-path-exists/i3status.conf @@ -0,0 +1,14 @@ +general { + output_format = "none" +} + +order += "path_exists EXISTING" +order += "path_exists NONEXISTANT" + +path_exists EXISTING { + path = "testcases/003-path-exists" +} + +path_exists NONEXISTANT { + path = "testcases/003-path-exists/nonexistant" +} From 9c472405234789bec8ce522ecab025a208481fbe Mon Sep 17 00:00:00 2001 From: eplanet Date: Mon, 14 Nov 2016 21:33:09 +0000 Subject: [PATCH 3/3] Added test case for run_watch The valid test case assumes pid 1 exists, which should always be true on Unix environment. --- testcases/004-run-watch/expected_output.txt | 1 + testcases/004-run-watch/i3status.conf | 14 ++++++++++++++ testcases/004-run-watch/pidfile | 1 + 3 files changed, 16 insertions(+) create mode 100644 testcases/004-run-watch/expected_output.txt create mode 100644 testcases/004-run-watch/i3status.conf create mode 100644 testcases/004-run-watch/pidfile diff --git a/testcases/004-run-watch/expected_output.txt b/testcases/004-run-watch/expected_output.txt new file mode 100644 index 0000000..3dbe379 --- /dev/null +++ b/testcases/004-run-watch/expected_output.txt @@ -0,0 +1 @@ +EXISTING: yes | NONEXISTANT: no diff --git a/testcases/004-run-watch/i3status.conf b/testcases/004-run-watch/i3status.conf new file mode 100644 index 0000000..95a9bb1 --- /dev/null +++ b/testcases/004-run-watch/i3status.conf @@ -0,0 +1,14 @@ +general { + output_format = "none" +} + +order += "run_watch EXISTING" +order += "run_watch NONEXISTANT" + +run_watch EXISTING { + pidfile = "testcases/004-run-watch/pidfile" +} + +run_watch NONEXISTANT { + pidfile = "testcases/004-run-watch/notexistant" +} diff --git a/testcases/004-run-watch/pidfile b/testcases/004-run-watch/pidfile new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/testcases/004-run-watch/pidfile @@ -0,0 +1 @@ +1