From 81fd69ae98337c20cb3e530d4efe13bec2fb3b20 Mon Sep 17 00:00:00 2001 From: Dominik Ritter Date: Sat, 4 Aug 2018 17:34:52 +0200 Subject: Update shunit2 to newest version --- test/functions/colors.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'test/functions/colors.spec') diff --git a/test/functions/colors.spec b/test/functions/colors.spec index 61a40087..bb06b719 100755 --- a/test/functions/colors.spec +++ b/test/functions/colors.spec @@ -39,4 +39,4 @@ function testIsSameColorDoesNotYieldNotEqualColorsTruthy() { } -source shunit2/source/2.1/src/shunit2 +source shunit2/shunit2 -- cgit v1.2.3 From 057b07b214def74248628a841f95045e3e85028c Mon Sep 17 00:00:00 2001 From: Dominik Ritter Date: Wed, 8 Aug 2018 01:01:14 +0200 Subject: Fix tests --- test/functions/colors.spec | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'test/functions/colors.spec') diff --git a/test/functions/colors.spec b/test/functions/colors.spec index 61a40087..b8fa3ad5 100755 --- a/test/functions/colors.spec +++ b/test/functions/colors.spec @@ -30,8 +30,8 @@ function testIsSameColorComparesAnsiBackgroundAndNumericalColorCorrectly() { assertTrue "isSameColor 'bg-green' '002'" } -function testIsSameColorComparesNumericalBackgroundAndNumericalColorCorrectly() { - assertTrue "isSameColor '010' '2'" +function testIsSameColorComparesShortCodesCorrectly() { + assertTrue "isSameColor '002' '2'" } function testIsSameColorDoesNotYieldNotEqualColorsTruthy() { -- cgit v1.2.3 From a0d57bc455e654ba688d108219bd254863bca438 Mon Sep 17 00:00:00 2001 From: Dominik Ritter Date: Thu, 9 Aug 2018 08:11:19 +0200 Subject: Add test for bright colors --- test/functions/colors.spec | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'test/functions/colors.spec') diff --git a/test/functions/colors.spec b/test/functions/colors.spec index d61923f5..e9ae9803 100755 --- a/test/functions/colors.spec +++ b/test/functions/colors.spec @@ -38,5 +38,14 @@ function testIsSameColorDoesNotYieldNotEqualColorsTruthy() { assertFalse "isSameColor 'green' '003'" } +function testBrightColorsWork() { + # We had some code in the past that equalized bright colors + # with normal ones. This code is now gone, and this test should + # ensure that all input channels for bright colors are handled + # correctly. + assertTrue "isSameColor 'cyan' '014'" + assertEquals '014' "$(getColorCode 'cyan')" + assertEquals '014' "$(getColor 'cyan')" +} source shunit2/shunit2 -- cgit v1.2.3 From 7a1319c2d98da16e0b2bd32dd43f9660a74ed8d7 Mon Sep 17 00:00:00 2001 From: Dominik Ritter Date: Fri, 10 Aug 2018 00:47:20 +0200 Subject: Add tests for color comparisons with none colors --- test/functions/colors.spec | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'test/functions/colors.spec') diff --git a/test/functions/colors.spec b/test/functions/colors.spec index e9ae9803..ce777913 100755 --- a/test/functions/colors.spec +++ b/test/functions/colors.spec @@ -22,6 +22,10 @@ function testGetColorCodeWithNumericalColor() { assertEquals '002' "$(getColorCode '002')" } +function testGetColorCodeWithNoneColor() { + assertEquals 'none' "$(getColorCode 'NONE')" +} + function testIsSameColorComparesAnsiForegroundAndNumericalColorCorrectly() { assertTrue "isSameColor 'green' '002'" } @@ -38,6 +42,18 @@ function testIsSameColorDoesNotYieldNotEqualColorsTruthy() { assertFalse "isSameColor 'green' '003'" } +function testIsSameColorHandlesNoneCorrectly() { + assertTrue "isSameColor 'none' 'NOnE'" +} + +function testIsSameColorCompareTwoNoneColorsCorrectly() { + assertTrue "isSameColor 'none' 'none'" +} + +function testIsSameColorComparesColorWithNoneCorrectly() { + assertFalse "isSameColor 'green' 'none'" +} + function testBrightColorsWork() { # We had some code in the past that equalized bright colors # with normal ones. This code is now gone, and this test should -- cgit v1.2.3