aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/fish_tests.cpp
Commit message (Collapse)AuthorAge
* Remove oopsies while pasting.Gravatar Aaron Gyes2016-06-25
| | | | | (also, last commit log had a typo. "3.4.0-Microsoft" is the string we should check for. Actual string in my code was correct.)
* Style fixes.Gravatar Aaron Gyes2016-06-23
|
* history --merge to properly interleave itemsGravatar ridiculousfish2016-06-23
| | | | Fixes #2312
* Remove inadvertent change in fish_tests.cppGravatar Aaron Gyes2016-06-23
|
* Make IWYU output in lint.cpp less messyGravatar Aaron Gyes2016-06-23
| | | | And re-run IWYU, adjust #includes.
* simplify some fish_tests codeGravatar Kurtis Rader2016-05-30
| | | | | This came to my attention because cppcheck was warning about possibly dereferncing a NULL pointer.
* fix random lint issuesGravatar Kurtis Rader2016-05-29
| | | | | | | | This only eliminates errors reported by `make lint`. It shouldn't cause any functional changes. This change does remove several functions that are unused. It also removes the `desc_arr` variable which is both unused and out of date with reality.
* Fix wide char related tests on CygwinGravatar Kurtis Rader2016-05-26
| | | | | | | | This makes the wide char tests run by `./fish_tests` pass on systems where sizeof wchar_t is two (e.g., Cygwin). In doing so it corrects several problems with the underlying code in module *utf8.cpp* such as allowing five and six byte UTF-8 sequences. They were allowed by the original Unicode proposal but are not allowed by the adopted standard.
* make fish buildable on OS X Snow LeopardGravatar Kurtis Rader2016-05-19
| | | | | | | | | | | | | I noticed that the `test_convert()` function was randomly failing when run on OS X Snow Leopard. I tracked it down to the `mbrtowc()` function on that OS being broken. Explicitly testing for UTF-8 prefixes that identify a sequence longer than four bytes (which the Unicode standard made illegal long ago) keeps us from having encoding errors on those OS's. This also makes the errors reported by the `test_convert()` function actually useful and readable. Lastly, it makes it possible to build fish on OS X Snow Leopard.
* add (or restore) config.h to all filesGravatar David Adam2016-05-18
| | | | | | | | The autoconf-generated config.h contains a number of directives which may alter the behaviour of system headers on certain platforms. Always include it in every C++ file as the first include. Closes #2993.
* trivial fix to fish_tests.cppGravatar Kurtis Rader2016-05-16
| | | | | | | Fix a minor bogosity I noticed while building fish on OS X Snow Leopard. It's technically not a bug because only old compilers complain about the original statement but this change makes the one line this changes consistent with the rest of the fish code.
* lint cleanup: eliminate "redundant" errorsGravatar Kurtis Rader2016-05-04
| | | | | This removes some pointless parentheses but the primary focus is removing redundancies like unnecessary "else" clauses.
* Suppress another pointless IWYU warningGravatar Kurtis Rader2016-05-02
|
* restyle fish modules to match project styleGravatar Kurtis Rader2016-04-30
| | | | | | Reduces lint errors from 60 to 60 (-0%). Line count from 5599 to 4925 (-12%). Another step in resolving issue #2902.
* add better support for IWYU and fix thingsGravatar Kurtis Rader2016-04-26
| | | | | | | | | Remove the "make iwyu" build target. Move the functionality into the recently introduced lint.fish script. Fix a lot, but not all, of the include-what-you-use errors. Specifically, it fixes all of the IWYU errors on my OS X server but only removes some of them on my Ubuntu 14.04 server. Fixes #2957
* another wcstring to wchar_t * changeGravatar Kurtis Rader2016-04-10
| | | | | | | | | | | In keeping with the change made by @ridiculousfish earlier today modify the `keyword_description()` function to return a const wchar_t pointer. Also, simplify the `token_type_description()` function to use the recently introduced mapping array. This changes the wording of many of the token type descriptions. However, I can't see this as being a problem since the original descriptions (e.g., "token_redirection") are no clearer to someone not acquainted with the implementation.
* fixes for cppcheck lint warningsGravatar Kurtis Rader2016-04-04
| | | | | | Refine the linting behavior. Fix several of the, mostly trivial, lint errors.
* lint: remove or comment out unused functionsGravatar Kurtis Rader2016-04-03
| | | | | | Cppcheck has identified a lot of unused functions. This removes funcs that are unlikely to ever be used. Others that might be useful for debugging I've commented out with "#if 0".
* Fix memory leaks at exit found in testsGravatar Andreas Nordal2016-03-27
| | | | | | | | | | This fixes all memory leaks found by compiling with clang++ -g -fsanitize=address and running the tests. Method: Ensure that memory is freed by the destructor of its respective container, either by storing objects directly instead of by pointer, or implementing the required destructor.
* assume getopt/getopt_long is availableGravatar Kurtis Rader2016-03-08
| | | | | | | | | | | There is no longer a good reason to detect whether or not getopt_long() is available. All UNIX implementations we're likely to run on have it. And if we ever find one that doesn't the right thing to do is not fallback to getopt() but to include the getopt_long() source in our package like we do with the pcre2 library. Since it's licensed under LGPL we can legally do so if it becomes necessary. This partially addresses issue #2790.
* Tweak UTF8 decoding interfaceGravatar ridiculousfish2016-03-02
| | | | | | | | Previously, when decoding UTF-8, we would first run through the array to compute the correct size, then allocate a buffer of that size, then run through the array again to fill the buffer, and then copy it into a std::wstring. With this fix we can copy it into the string directly, reducing allocations and only requiring a single pass.
* Allow parse_execution_context to take ownership of a parse treeGravatar ridiculousfish2016-02-28
| | | | | | Introduces a new template moved_ref which is like an rvalue reference. This allows passing around objects while being explicit that the receiver may acquire ownership. This will help reduce some allocations.
* Mark a bunch of constructors as explicitGravatar ridiculousfish2016-02-27
| | | | This prevents undesired implicit conversions
* Make expand_argument_list a static functionGravatar ridiculousfish2016-02-27
| | | | It doesn't use any properties of parser_t
* Eliminate parser_t::show_errorsGravatar ridiculousfish2016-02-27
| | | | Errors are now unconditionally shown
* Eliminate parser_type_tGravatar ridiculousfish2016-02-27
| | | | It was never fully implemented and wasn't used for anything
* Allow variable completion from just a $Gravatar ridiculousfish2016-02-27
| | | | | Previously there had to be some variable text, now you can tab complete from just a naked $.
* Remove some newly dead codeGravatar ridiculousfish2016-02-18
| | | | out_suggested_cdpath is no longer required from is_potential_path
* Implement the cd "unique hierarchy" autosuggestion in expand.cppGravatar ridiculousfish2016-02-18
|
* Teach tests about changes to special autosuggestionsGravatar ridiculousfish2016-02-18
|
* Always env_set_pwd after chdir in the fish testsGravatar ridiculousfish2016-02-18
| | | | This avoids confusion between getcwd() and $PWD
* Additional work on unifying cd autosuggestions with completeGravatar ridiculousfish2016-02-18
|
* Complete to take a pointer to output completions, not a mutable refGravatar ridiculousfish2016-02-18
|
* Switch autosuggest_suggest_special to returning a completion_tGravatar ridiculousfish2016-02-18
|
* fish_tests: Explicitly cast -2 to wchar_tGravatar Andy Lutomirski2016-02-08
| | | | | | On arm, wchar_t is unsigned, and C++11 and newer disallow implicit narrowing conversions inside braces. Use an explicit conversion to fix the build on GCC 6 and up, which defaults to C++11.
* Prefer special autosuggestions to match caseGravatar ridiculousfish2016-02-04
| | | | Fixes #2672
* Don't crash when autosuggesting cd'ing into a directory with ~Gravatar ridiculousfish2016-02-02
| | | | Fixes #2696
* Clean up complete_entry_opt_tGravatar ridiculousfish2016-01-16
| | | | | | | Rather than storing short and long options separately, using a complicated set of invariants, store them in a single string and use an explicit type complete_option_type_t to track how they are interpreted.
* fish_tests.cpp: use temporary path for completion testsGravatar David Adam2015-11-27
| | | | Closes #2322
* Attempt to fix the sporadic uvar test failures on LinuxGravatar ridiculousfish2015-11-08
| | | | | | | | | | | | | | | | | | We identify when the universal variable file has changed out from under us by comparing a bunch of fields from its stat: inode, device, size, high-precision timestamp, generation. Linux aggressively reuses inodes, and the size may be the same by coincidence (which is the case in the tests). Also, Linux officially has nanosecond precision, but in practice it seems to only uses millisecond precision for storing mtimes. Thus if there are three or more updates within a millisecond, every field we check may be the same, and we are vulnerable to the ABA problem. I believe this explains the occasional test failures. The solution is to manually set the nanosecond field of the mtime timestamp to something unlikely to be duplicated, like a random number, or better yet, the current time (with nanosecond precision). This is more in the spirit of the timestamp, and it means we're around a million times less likely to collide. This seems to fix the tests.
* Teach the cd autosuggestion how to descend "unique" hierarchiesGravatar ridiculousfish2015-11-07
| | | | | | | | If we are cd'ing into a directory, and the directory has only one child which is itself a directory, the autosuggestion should descend as far as it can. Fixes #2531
* Correct tests for new location of fish_historyGravatar Jeff Kowalski2015-10-16
| | | | | | | | The fish_history file is now located in the "data" directory ($XDG_DATA_HOME/fish or ~/.local/share/fish), accessible using the function `path_get_data`. (This commit also cleans trailing whitespace in the source file.)
* Fix for recursive wildcard expansion ignoring directoriesGravatar ridiculousfish2015-09-27
| | | | | When ascending out of a directory, we need to clear the directory from the visited set. Fixes #2414.
* Trailing slashes in wildcards need to match directoriesGravatar ridiculousfish2015-09-27
| | | | Fixes the wrong sense in a waccess test.
* Teach builtin_string to recognize redirections, not just pipesGravatar ridiculousfish2015-09-25
| | | | | Allows cases like `string split \n < file.txt` to work. Fixes 2422
* Eliminate global variables associated with builtin IOGravatar ridiculousfish2015-09-22
| | | | | | | This change eliminates global variables like stdout_buffer. Instead we wrap up the IO information into a new struct io_streams_t, and thread that through every builtin. This makes the intent clearer, gives us a place to hang new IO data, and eliminates the ugly global state management like builtin_push_io.
* Merge new string builtinGravatar Michael Steed2015-09-21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This adds the new builtin 'string' which supports various string manipulation and matching algorithms, including PCRE based regular expressions. Fixes #2296 Squashed commit of the following: commit 4c3eaeb6e57d76463e9683c327142b0aeafb92b8 Author: ridiculousfish <corydoras@ridiculousfish.com> Date: Sat Sep 12 12:51:30 2015 -0700 Remove testdata and doc dirs from pcre2 source commit b2a8b4b50f2398b204fb72cfe4b5ba77ece2e1ab Merge: 11c8a47 7974aab Author: ridiculousfish <corydoras@ridiculousfish.com> Date: Sat Sep 12 12:32:40 2015 -0700 Merge branch 'string' of git://github.com/msteed/fish-shell into string-test commit 7974aab6d367f999f1140ab34c2535cef5cf3b00 Author: Michael Steed <msteed@saltstack.com> Date: Fri Sep 11 13:00:02 2015 -0600 build pcre2 lib only, no docs commit eb20b43d2d96b7e6d24618158ce71078de83c40b Merge: 1a09e70 5f519cb Author: Michael Steed <msteed68@gmail.com> Date: Thu Sep 10 20:00:47 2015 -0600 Merge branch 'string' of github.com:msteed/fish-shell into string commit 1a09e709d028393c9e9e6dc9a84278f399a15f3d Author: Michael Steed <msteed68@gmail.com> Date: Thu Sep 10 19:58:24 2015 -0600 rebase on master & address the fallout commit a0ec9772cd1a0a548a501a7633be05dab4e5ee46 Author: Michael Steed <msteed68@gmail.com> Date: Thu Sep 10 19:26:45 2015 -0600 use fish's wildcard_match() for glob matching commit 64c25a01e3f7234f220ba13545cf658a7492b1a4 Author: Michael Steed <msteed68@gmail.com> Date: Thu Aug 27 08:19:23 2015 -0600 some fixes from review - string_get_arg_stdin(): simplify and don't discard the argument when the trailing newline is absent - fix calls to pcre2 for e.g. string match -r -a 'a*' 'b' - correct test for args coming from stdin commit ece7f35ec5f4093763627d68d671b6c0c876896d Author: Michael Steed <msteed68@gmail.com> Date: Sat Aug 22 19:35:56 2015 -0600 fixes from review - Makefile.in: restore iwyu target - regex_replacer_t::replace_matches(): correct size passed to realloc() commit 9ff7477a926c4572e26171cab3cd42f8086be678 Author: Michael Steed <msteed68@gmail.com> Date: Thu Aug 20 13:08:33 2015 -0600 Minor doc improvements commit baf4e096b22dde3063b85b833795eb570d660ba7 Author: Michael Steed <msteed68@gmail.com> Date: Wed Aug 19 18:29:02 2015 -0600 another attempt to fix the ci build commit 896a2c2b279a419747bea26102229fbe84534a6f Author: Michael Steed <msteed68@gmail.com> Date: Wed Aug 19 18:03:49 2015 -0600 Updates after review comments - make match/replace without -a operate on the first match on each argument - use different exit codes for "no operation performed" and errors, as grep does - refactor regex compile code - use human-friendly error messages from pcre2 - improve error handling & reporting elsewhere - add a few tests - make some doc fixes - some simplification & cleanup - fix ci build failure (I hope) commit efd47dcbda2ca247d58bee56a7774cd75a1062fd Author: Michael Steed <msteed68@gmail.com> Date: Wed Aug 12 00:26:07 2015 -0600 fix dependencies for parallel make commit ed0850e2db467362066a3d94e3ececd17c1756cd Author: Michael Steed <msteed68@gmail.com> Date: Tue Aug 11 23:37:22 2015 -0600 Add missing pcre2 files + .gitignore commit 9492e7a7e929c03554336be1ddf80ca6b37f53c5 Author: Michael Steed <msteed68@gmail.com> Date: Tue Aug 11 22:44:05 2015 -0600 add pcre2-10.20 and update license.hdr commit 1a60b933718feb20c0bf7c9e257b8e495014ea1b Author: Michael Steed <msteed68@gmail.com> Date: Tue Aug 11 22:41:19 2015 -0600 add string builtin files - string builtin source, tests, & docs - changes to configure.ac & Makefile.in commit 5f519cb2a2c05213e0a88a7add7af288bc1c1352 Author: Michael Steed <msteed68@gmail.com> Date: Thu Sep 10 19:26:45 2015 -0600 use fish's wildcard_match() for glob matching commit 2ecd24f79500879e2de5bdf1b4c19dd44fc6ac85 Author: Michael Steed <msteed68@gmail.com> Date: Thu Aug 27 08:19:23 2015 -0600 some fixes from review - string_get_arg_stdin(): simplify and don't discard the argument when the trailing newline is absent - fix calls to pcre2 for e.g. string match -r -a 'a*' 'b' - correct test for args coming from stdin commit 45b777e4dc85c05cd4a186f4bdcae543c21aaf08 Author: Michael Steed <msteed68@gmail.com> Date: Sat Aug 22 19:35:56 2015 -0600 fixes from review - Makefile.in: restore iwyu target - regex_replacer_t::replace_matches(): correct size passed to realloc() commit 981cbb6ddf742a5fe8881af916e7b870b7e6422a Author: Michael Steed <msteed68@gmail.com> Date: Thu Aug 20 13:08:33 2015 -0600 Minor doc improvements commit ddb6a2a8fdb6aa31aad41e80d5481bb32c6ed8ff Author: Michael Steed <msteed68@gmail.com> Date: Wed Aug 19 18:29:02 2015 -0600 another attempt to fix the ci build commit 1e34e3191b028162863d263e9868052f75194aa5 Author: Michael Steed <msteed68@gmail.com> Date: Wed Aug 19 18:03:49 2015 -0600 Updates after review comments - make match/replace without -a operate on the first match on each argument - use different exit codes for "no operation performed" and errors, as grep does - refactor regex compile code - use human-friendly error messages from pcre2 - improve error handling & reporting elsewhere - add a few tests - make some doc fixes - some simplification & cleanup - fix ci build failure (I hope) commit 34232e152df17a3cfbf0a094dd51d148a4f04e6f Author: Michael Steed <msteed68@gmail.com> Date: Wed Aug 12 00:26:07 2015 -0600 fix dependencies for parallel make commit 00d7e781697f53454beb91c1d0fc4b2d28d6e034 Author: Michael Steed <msteed68@gmail.com> Date: Tue Aug 11 23:37:22 2015 -0600 Add missing pcre2 files + .gitignore commit 4498aa5f576e09634f7f619443e74d2f33c108e4 Author: Michael Steed <msteed68@gmail.com> Date: Tue Aug 11 22:44:05 2015 -0600 add pcre2-10.20 and update license.hdr commit 290c58c72e22db644ccf6fa9088051644980ed0a Author: Michael Steed <msteed68@gmail.com> Date: Tue Aug 11 22:41:19 2015 -0600 add string builtin files - string builtin source, tests, & docs - changes to configure.ac & Makefile.in
* Fix tests under certain vswprintf callsGravatar ridiculousfish2015-09-12
| | | | | Work around an issue where vswprintf may not append ANY_STRING from a format specifier
* Remove some dead #definesGravatar ridiculousfish2015-08-11
|
* Correct the caret position for unbalanced square bracketsGravatar ridiculousfish2015-08-10
|