From 0cbc43927d93af1236b092dee3fa5f167f20bca1 Mon Sep 17 00:00:00 2001 From: MadMaurice Date: Thu, 8 Apr 2021 23:52:03 +0200 Subject: [PATCH] Add tests for 'or' --- t/and_or.t | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/t/and_or.t b/t/and_or.t index 3278a90..6b13400 100644 --- a/t/and_or.t +++ b/t/and_or.t @@ -2,12 +2,21 @@ (and nil (set a 'fail)) (expect "and - Short circuit" (equal a 'ok))) -;; (let ((a 'ok)) -;; (or t (set a 'fail)) -;; (expect "or - short circuit" (equal a 'ok))) - (expect "and - returns last value if all operands evaluate to true" (equal (and t 'ok) 'ok)) (expect "and - returns nil if any operand evaluates to false" (null (and nil t))) + +(expect "and - returns nil if no operands supplied" + (null (and))) + +(let ((a 'ok)) + (or t (set a 'fail)) + (expect "or - short circuit" (equal a 'ok))) + +(expect "or - returns last value if all operands evaluate to false" + (equal (or nil 'ok) 'ok)) + +(expect "or - returns nil if no operands supplied" + (null (or)))