aboutsummaryrefslogtreecommitdiffhomepage
path: root/fish_tests.cpp
diff options
context:
space:
mode:
authorGravatar ridiculousfish <corydoras@ridiculousfish.com>2013-10-09 02:03:50 -0700
committerGravatar ridiculousfish <corydoras@ridiculousfish.com>2013-10-09 02:03:50 -0700
commit7b86b2e05a011e37bf11bba2675ef5db684bca24 (patch)
treea750da222346b8a20f193b8bd8316d235d3f129f /fish_tests.cpp
parenta51bd03a5c86d5532063610cc185f3d377daa4e1 (diff)
Adoption of new parser in abbreviations
Diffstat (limited to 'fish_tests.cpp')
-rw-r--r--fish_tests.cpp20
1 files changed, 14 insertions, 6 deletions
diff --git a/fish_tests.cpp b/fish_tests.cpp
index 6c77ec08..99ed6cd3 100644
--- a/fish_tests.cpp
+++ b/fish_tests.cpp
@@ -61,7 +61,6 @@
#include "signal.h"
#include "highlight.h"
#include "parse_tree.h"
-#include "parse_exec.h"
#include "parse_util.h"
/**
@@ -769,6 +768,11 @@ static void test_abbreviations(void)
expanded = reader_expand_abbreviation_in_command(L"of gc", wcslen(L"of gc"), &result);
if (expanded) err(L"gc incorrectly expanded on line %ld", (long)__LINE__);
+ /* others should not be */
+ expanded = reader_expand_abbreviation_in_command(L"command gc", wcslen(L"command gc"), &result);
+ if (expanded) err(L"gc incorrectly expanded on line %ld", (long)__LINE__);
+
+
env_pop();
}
@@ -1916,12 +1920,16 @@ static void test_new_parser_fuzzing(void)
size_t max = 5;
for (size_t len=1; len <= max; len++)
{
- fprintf(stderr, "%lu / %lu\n", len, max);
+ fprintf(stderr, "%lu / %lu...", len, max);
std::vector<parser_fuzz_token_t> tokens(len);
+ size_t count = 0;
+ parse_t parser;
+ parse_node_tree_t parse_tree;
do
{
- parse_t parser;
- parse_node_tree_t parse_tree;
+ parser.clear();
+ parse_tree.clear();
+ count++;
for (size_t i=0; i < len; i++)
{
const parser_fuzz_token_t &token = tokens[i];
@@ -1931,6 +1939,7 @@ static void test_new_parser_fuzzing(void)
// keep going until we wrap
}
while (! increment(tokens));
+ fprintf(stderr, "done (%lu)\n", count);
}
double end = timef();
say(L"All fuzzed in %f seconds!", end - start);
@@ -2108,7 +2117,7 @@ int main(int argc, char **argv)
say(L"Testing low-level functionality");
set_main_thread();
setup_fork_guards();
- //proc_init();
+ //proc_init(); //disabling this prevents catching SIGINT
event_init();
function_init();
builtin_init();
@@ -2116,7 +2125,6 @@ int main(int argc, char **argv)
env_init();
test_highlighting();
- return 0;
test_new_parser_fuzzing();
test_new_parser_correctness();
test_highlighting();