From cd878c2cb551572f614b4feebeb0de01a3b1daf9 Mon Sep 17 00:00:00 2001 From: Maciek Swiech Date: Sun, 31 May 2020 19:50:36 -0600 Subject: [PATCH] added bats --- .gitmodules | 9 +++++++++ bashtop | 4 ++++ test/bats | 8 ++++++++ test/libs/bats | 1 + test/libs/bats-assert | 1 + test/libs/bats-support | 1 + 6 files changed, 24 insertions(+) create mode 100644 .gitmodules create mode 100644 test/bats create mode 160000 test/libs/bats create mode 160000 test/libs/bats-assert create mode 160000 test/libs/bats-support diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..dedb624 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,9 @@ +[submodule "test/libs/bats"] + path = test/libs/bats + url = https://github.com/sstephenson/bats +[submodule "test/libs/bats-assert"] + path = test/libs/bats-assert + url = https://github.com/ztombol/bats-assert +[submodule "test/libs/bats-support"] + path = test/libs/bats-support + url = https://github.com/ztombol/bats-support diff --git a/bashtop b/bashtop index ee4c6fe..2f07e3c 100755 --- a/bashtop +++ b/bashtop @@ -4822,6 +4822,10 @@ else exec 2>/dev/null fi + +#* if we have been sourced by another shell, quit. Allows sourcing only function definition. +[[ "${#BASH_SOURCE[@]}" -gt 1 ]] && { return 0; } + #* Call init function init_ diff --git a/test/bats b/test/bats new file mode 100644 index 0000000..fbb4b89 --- /dev/null +++ b/test/bats @@ -0,0 +1,8 @@ +#!/usr/bin/env bats + +source bashtop + +@test "im a toy" { + result=$(echo hello) + [ "$result" = "hello" ] +} diff --git a/test/libs/bats b/test/libs/bats new file mode 160000 index 0000000..0360811 --- /dev/null +++ b/test/libs/bats @@ -0,0 +1 @@ +Subproject commit 03608115df2071fff4eaaff1605768c275e5f81f diff --git a/test/libs/bats-assert b/test/libs/bats-assert new file mode 160000 index 0000000..9f88b42 --- /dev/null +++ b/test/libs/bats-assert @@ -0,0 +1 @@ +Subproject commit 9f88b4207da750093baabc4e3f41bf68f0dd3630 diff --git a/test/libs/bats-support b/test/libs/bats-support new file mode 160000 index 0000000..004e707 --- /dev/null +++ b/test/libs/bats-support @@ -0,0 +1 @@ +Subproject commit 004e707638eedd62e0481e8cdc9223ad471f12ee