summaryrefslogtreecommitdiff
path: root/integration_tests
diff options
context:
space:
mode:
authorewy <ewy0@protonmail.com>2026-05-17 01:37:24 +0200
committerewy <ewy0@protonmail.com>2026-05-17 01:37:24 +0200
commitf5807d9f3a6c96e70912b61fac17120f412b5782 (patch)
treed6928795e06b1af000ffba2ae50bb6f8f7b72685 /integration_tests
parent7984fd9beaa7c903288142818cb328c584a139a5 (diff)
* integration tests with a pik target to run them
* add abstraction for paths to facilitate unit tests * flesh out completion (--install-completion) * do sync init before stateless modes so list knows more
Diffstat (limited to 'integration_tests')
-rw-r--r--integration_tests/defaults/.pik/defaults.sh3
-rw-r--r--integration_tests/defaults/.pik/dir/dir.sh2
-rw-r--r--integration_tests/defaults/README.md2
-rw-r--r--integration_tests/defaults/full.test.sh6
-rw-r--r--integration_tests/defaults/source.test.sh6
-rw-r--r--integration_tests/defaults/source_full.test.sh6
-rw-r--r--integration_tests/defaults/subdir.test.sh6
-rw-r--r--integration_tests/defaults/subdir_with_source.test.sh6
-rw-r--r--integration_tests/simple/.pik/echo.sh2
-rw-r--r--integration_tests/simple/.pik/result.sh2
-rw-r--r--integration_tests/simple/README.md1
-rw-r--r--integration_tests/simple/echo.test.sh5
-rw-r--r--integration_tests/simple/echo_full.test.sh5
-rw-r--r--integration_tests/simple/nonexistent_target.test.sh5
-rw-r--r--integration_tests/simple/result.test.sh5
15 files changed, 62 insertions, 0 deletions
diff --git a/integration_tests/defaults/.pik/defaults.sh b/integration_tests/defaults/.pik/defaults.sh
new file mode 100644
index 0000000..6500c83
--- /dev/null
+++ b/integration_tests/defaults/.pik/defaults.sh
@@ -0,0 +1,3 @@
+#!/usr/bin/env bash
+# i have the same name as the source directory
+echo "banana" \ No newline at end of file
diff --git a/integration_tests/defaults/.pik/dir/dir.sh b/integration_tests/defaults/.pik/dir/dir.sh
new file mode 100644
index 0000000..8d6b69b
--- /dev/null
+++ b/integration_tests/defaults/.pik/dir/dir.sh
@@ -0,0 +1,2 @@
+#!/usr/bin/env bash
+echo "apple" \ No newline at end of file
diff --git a/integration_tests/defaults/README.md b/integration_tests/defaults/README.md
new file mode 100644
index 0000000..9aaf7eb
--- /dev/null
+++ b/integration_tests/defaults/README.md
@@ -0,0 +1,2 @@
+these tests check whether pik's default targets (sharing a name with either subdirectory or source folder) are selected
+by default. \ No newline at end of file
diff --git a/integration_tests/defaults/full.test.sh b/integration_tests/defaults/full.test.sh
new file mode 100644
index 0000000..05d3ee4
--- /dev/null
+++ b/integration_tests/defaults/full.test.sh
@@ -0,0 +1,6 @@
+#!/usr/bin/env bash
+result="$($PIK defaults dir dir)"
+if [[ ! "$result" == *"apple"* ]] ; then
+ echo "expected apple" >&2
+ exit 1
+fi
diff --git a/integration_tests/defaults/source.test.sh b/integration_tests/defaults/source.test.sh
new file mode 100644
index 0000000..ee966f4
--- /dev/null
+++ b/integration_tests/defaults/source.test.sh
@@ -0,0 +1,6 @@
+#!/usr/bin/env bash
+result="$($PIK defaults)"
+if [[ ! "$result" == *"banana"* ]] ; then
+ echo "expected banana" >&2
+ exit 1
+fi \ No newline at end of file
diff --git a/integration_tests/defaults/source_full.test.sh b/integration_tests/defaults/source_full.test.sh
new file mode 100644
index 0000000..91784c4
--- /dev/null
+++ b/integration_tests/defaults/source_full.test.sh
@@ -0,0 +1,6 @@
+#!/usr/bin/env bash
+result="$($PIK defaults defaults)"
+if [[ ! "$result" == *"banana"* ]] ; then
+ echo "expected banana" >&2
+ exit 1
+fi \ No newline at end of file
diff --git a/integration_tests/defaults/subdir.test.sh b/integration_tests/defaults/subdir.test.sh
new file mode 100644
index 0000000..6edd874
--- /dev/null
+++ b/integration_tests/defaults/subdir.test.sh
@@ -0,0 +1,6 @@
+#!/usr/bin/env bash
+result="$($PIK dir)"
+if [[ ! "$result" == *"apple"* ]] ; then
+ echo "expected apple" >&2
+ exit 1
+fi
diff --git a/integration_tests/defaults/subdir_with_source.test.sh b/integration_tests/defaults/subdir_with_source.test.sh
new file mode 100644
index 0000000..3f41277
--- /dev/null
+++ b/integration_tests/defaults/subdir_with_source.test.sh
@@ -0,0 +1,6 @@
+#!/usr/bin/env bash
+result="$($PIK defaults dir)"
+if [[ ! "$result" == *"apple"* ]] ; then
+ echo "expected apple" >&2
+ exit 1
+fi
diff --git a/integration_tests/simple/.pik/echo.sh b/integration_tests/simple/.pik/echo.sh
new file mode 100644
index 0000000..c8a6153
--- /dev/null
+++ b/integration_tests/simple/.pik/echo.sh
@@ -0,0 +1,2 @@
+#!/usr/bin/env bash
+echo "$@" \ No newline at end of file
diff --git a/integration_tests/simple/.pik/result.sh b/integration_tests/simple/.pik/result.sh
new file mode 100644
index 0000000..7a534a6
--- /dev/null
+++ b/integration_tests/simple/.pik/result.sh
@@ -0,0 +1,2 @@
+#!/usr/bin/env bash
+echo "banana" \ No newline at end of file
diff --git a/integration_tests/simple/README.md b/integration_tests/simple/README.md
new file mode 100644
index 0000000..6925e22
--- /dev/null
+++ b/integration_tests/simple/README.md
@@ -0,0 +1 @@
+these tests try some simple pik usage \ No newline at end of file
diff --git a/integration_tests/simple/echo.test.sh b/integration_tests/simple/echo.test.sh
new file mode 100644
index 0000000..917a76d
--- /dev/null
+++ b/integration_tests/simple/echo.test.sh
@@ -0,0 +1,5 @@
+#!/usr/bin/env bash
+if [[ "$($PIK result)" != *"banana"* ]] ; then
+ echo "expected banana" 1>&2
+ exit 1
+fi \ No newline at end of file
diff --git a/integration_tests/simple/echo_full.test.sh b/integration_tests/simple/echo_full.test.sh
new file mode 100644
index 0000000..7290cd2
--- /dev/null
+++ b/integration_tests/simple/echo_full.test.sh
@@ -0,0 +1,5 @@
+#!/usr/bin/env bash
+if [[ "$($PIK simple result)" != *"banana"* ]] ; then
+ echo "expected banana" 1>&2
+ exit 1
+fi \ No newline at end of file
diff --git a/integration_tests/simple/nonexistent_target.test.sh b/integration_tests/simple/nonexistent_target.test.sh
new file mode 100644
index 0000000..4915e77
--- /dev/null
+++ b/integration_tests/simple/nonexistent_target.test.sh
@@ -0,0 +1,5 @@
+#!/usr/bin/env bash
+if [[ "$($PIK 123)" != "" ]] ; then
+ echo "expected no output" 1>&2
+ exit 1
+fi \ No newline at end of file
diff --git a/integration_tests/simple/result.test.sh b/integration_tests/simple/result.test.sh
new file mode 100644
index 0000000..3d4a2bc
--- /dev/null
+++ b/integration_tests/simple/result.test.sh
@@ -0,0 +1,5 @@
+#!/usr/bin/env bash
+if [[ "$($PIK echo asdf)" != *"asdf"* ]] ; then
+ echo "expected banana" 1>&2
+ exit 1
+fi \ No newline at end of file