From 143ead8d00f57cbb6baa3830e2b9724d6d6a271a Mon Sep 17 00:00:00 2001 From: ridiculousfish Date: Wed, 7 Mar 2012 01:13:24 -0800 Subject: [PATCH] Fix builtin_test to properly handle last expression in a combining expression --- builtin_test.cpp | 2 +- fish_tests.cpp | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/builtin_test.cpp b/builtin_test.cpp index 220732046..16403598c 100644 --- a/builtin_test.cpp +++ b/builtin_test.cpp @@ -419,7 +419,7 @@ namespace test_expressions { assert(combiners.size() + 1 == subjects.size()); assert(! subjects.empty()); - size_t idx = 0, max = combiners.size(); + size_t idx = 0, max = subjects.size(); bool or_result = false; while (idx < max) { if (or_result) { diff --git a/fish_tests.cpp b/fish_tests.cpp index ea0faf133..2a6fd3dfe 100644 --- a/fish_tests.cpp +++ b/fish_tests.cpp @@ -649,6 +649,11 @@ static void test_test() { assert(run_test_test(1, L"-x /bin/ls_not_a_path")); assert(run_test_test(0, L"-d /bin/")); assert(run_test_test(1, L"-d /bin/ls")); + + /* This failed at once point */ + assert(run_test_test(1, L"-d /bin -a 5 -eq 3")); + assert(run_test_test(0, L"-d /bin -o 5 -eq 3")); + assert(run_test_test(0, L"-d /bin -a ! 5 -eq 3")); }