Kevin Ballard
cc49042294
Parse slices even for empty variables
...
When a variable is parsed as being empty, parse out the slice and
validate the indexes anyway, behaving for slicing purposes as if the
variable had a single empty value.
Besides providing errors when expected, this also fixes the following:
set -l foo
echo "$foo[1]"
This used to print "[1]", now it properly prints nothing.
2014-08-20 22:09:32 -07:00
Kevin Ballard
3981b644d6
Fix double expansions ($$foo
)
...
Double expansions of variables had the following issues:
* `"$$foo"` threw an error no matter what the value of `$foo` was.
* `set -l foo ''; echo $$foo` threw an error because of the expansion of
`$foo` to `''`.
With this change, double expansion always works properly. When
double-expanding a multi-valued variable, in a double-quoted string the
first word of the inner expansion is used for the outer expansion, and
outside of a quoted string every word is used for the double-expansion
in each of the arguments.
> set -l foo bar baz
> set -l bar one two
> set -l baz three four
> echo "$$foo"
one two baz
> echo $$foo
one two three four
2014-08-20 21:45:07 -07:00
ridiculousfish
52ae5f885e
Improve history robustness against corrupt files
...
Fixes #1581
2014-07-29 14:42:03 -07:00
ridiculousfish
98297e5234
Teach while loops to not hang forever with no-execute
...
Fixes #1543
2014-07-11 11:28:10 -07:00
ridiculousfish
18c1b12741
Switch variable name in tests from foo to something less likely to be
...
used accidentally
2014-07-06 20:41:21 -07:00
ridiculousfish
b19f45e15d
Add test for issue 1526
2014-07-06 18:12:18 -07:00
ridiculousfish
3cbace98a7
'echo -' should output a dash instead of treating it as options
...
Fixes #1459
2014-05-16 15:19:07 +08:00
Konrad Borowski
7f2c4cbf8a
Move the empty function test to tests.
2014-05-06 12:31:44 +02:00
Konrad Borowski
91ebe12fc2
Add test for empty function name.
2014-05-06 12:18:09 +02:00
ridiculousfish
b01d09d704
Set the job property of block_t before expanding arguments associated
...
with the job, fixing psub. Fixes #1394
2014-04-02 00:32:08 -07:00
ridiculousfish
d232a0f951
Implement status -n (line number) with new parser
2014-03-01 16:04:13 -08:00
ridiculousfish
bc43409624
Expand the variable name as an ordinary parameter in for loops. Added
...
test for it too.
2014-02-21 18:20:51 -08:00
ridiculousfish
29ddb68da4
Tests and fix to allow return to work correctly within if statements. Closes #1297 .
2014-02-12 01:39:06 -08:00
ridiculousfish
e632d39b1f
Make if statements always return success at the end, matching other
...
shells. Fixes #1061 .
2014-02-07 17:57:53 -08:00
ridiculousfish
699d78bcfe
Make the test harness output file diffs on failure
2014-02-04 11:28:29 -08:00
David Adam
3106cffb65
Makefile/tests: use return values to communicate errors
2014-01-15 23:50:42 +08:00
ridiculousfish
d9056081e7
Added tests for piping an fd other than stdout
2014-01-13 02:49:41 -08:00
ridiculousfish
a9787b769f
Support for implicit cd, no-exec, and the exit builtin. All tests now
...
pass (!). Error reporting still unsteady.
2013-12-29 16:23:26 -08:00
ridiculousfish
a42711e31c
Support for break/continue with new parser execution
2013-12-28 22:52:06 -08:00
ridiculousfish
5cf59de676
Finish rewriting detect_errors to use new parser. All tests now pass (!)
2013-12-12 18:18:07 -08:00
ridiculousfish
e849beabba
Initial work towards various IO cleanups with an eye to fixing https://github.com/fish-shell/fish-shell/issues/110
2013-08-19 18:06:24 -07:00
ridiculousfish
640118e781
Cleanup of code that decides whether or not to fork. Fix for issue where stderr may be output twice.
2013-06-16 23:26:43 -07:00
ridiculousfish
3ea8d83d3f
Try to fix printf tests on Linux
2013-04-03 18:04:17 -07:00
Siteshwar Vashisht
3ac9621f87
Enabled test cases for unicode characters in printf builtin
2013-03-29 12:26:15 +05:30
ridiculousfish
b04e874e43
Teach fish how to push and pop blocks even in the face of no_exec. All tests finally pass.
...
https://github.com/fish-shell/fish-shell/issues/624
2013-03-25 16:06:12 -07:00
ridiculousfish
d146f578a4
Fix printf output to store \r instead of \n
...
Is git breaking line endings?
2013-03-24 15:58:24 -07:00
ridiculousfish
9394583f96
Implement actual error handling for builtin_printf. Fix the tests.
2013-03-24 15:58:24 -07:00
Siteshwar Vashisht
be7d02ebdd
Added test cases for printf builtin
2013-03-03 00:45:34 +05:30
ridiculousfish
ad8d68dd43
Make subcommands modify $status, and make builtin_set not modify status unless it fails
...
https://github.com/fish-shell/fish-shell/issues/547
https://github.com/fish-shell/fish-shell/issues/214
2013-01-31 15:57:08 -08:00
Jan Kanis
640beafa8c
fix a memory leak in profiling, add a profiling test
2013-01-14 01:38:05 +01:00
ridiculousfish
dc37a8079e
Added a seq function that defers to the seq command if present
...
https://github.com/fish-shell/fish-shell/issues/137
2013-01-12 14:18:34 -08:00
Jan Kanis
9ee7b0a501
really fix bug in export status of universal vars; add tests for that bug
2013-01-02 23:31:30 -08:00
Jan Kanis
8a446f43ff
include fixes and suggestions from code review
2012-12-22 18:38:28 +01:00
Jan Kanis
af3059ab2a
Allow 'emit' to accept event arguments
2012-12-20 16:13:00 +01:00
Jan Kanis
1f0ae8b06d
fixed #449 , added test
2012-12-20 16:11:46 +01:00
ridiculousfish
bf27cb1f5e
Further fixes to newline escaping
...
Addresses issue described in https://github.com/fish-shell/fish-shell/issues/347#issuecomment-10650443
2012-11-23 12:03:36 -08:00
ridiculousfish
90495f3ac5
Implement new newline-escaping behavior. Backslashes at the end of lines now essentially delete the newline, within normal text or double quotes. Backslashes are retained within single quotes.
...
Fixes https://github.com/fish-shell/fish-shell/issues/347
Fixes https://github.com/fish-shell/fish-shell/issues/52
2012-11-22 01:09:07 -08:00
ridiculousfish
e9d216bc84
Fixed recursive brace expansion
...
https://github.com/fish-shell/fish-shell/issues/399
2012-11-20 13:52:53 -08:00
ridiculousfish
7bb844a778
Fix bug where 'else if' does not support functions and redirections
...
https://github.com/fish-shell/fish-shell/issues/359
2012-11-04 17:11:02 -08:00
ridiculousfish
57de1388e8
Make the \c special character in echo suppress the newline too
2012-10-17 02:59:43 -07:00
ridiculousfish
7ee0ce745e
Implement -e option to echo (to interpret special characters), and -E to not interpret them
...
https://github.com/fish-shell/fish-shell/issues/337
2012-10-17 02:56:03 -07:00
ridiculousfish
91e1d59869
Fix for issue where else if would fail to pass arguments to commands. Also implements short-circuiting for and/or so that non-existent commands don't produce error messages.
...
Fixes https://github.com/fish-shell/fish-shell/issues/345
Fixes https://github.com/fish-shell/fish-shell/issues/349
2012-10-17 01:07:34 -07:00
ridiculousfish
1a59346b51
Changed "elseif" to "else if"
2012-09-03 13:24:01 -07:00
ridiculousfish
cc1395797e
First stab at elseif implementation
2012-09-01 01:46:14 -07:00
ridiculousfish
bb4a05032b
Merge branch 'index_range'
2012-07-19 10:59:11 -07:00
maxfl
11dd904b6d
Tests for contains -i
2012-07-10 16:21:00 -07:00
maxfl
079f17761c
Fix case when first index is command substitution
2012-07-08 09:45:34 +08:00
maxfl
e1b8c425da
Fix case when second limit is a variable:
...
echo $PATH[1..$n]
2012-07-08 09:39:39 +08:00
maxfl
5f05756e65
Add variable expand ranges
...
echo $PATH[-1..1] #now works
Add tests for ranges
2012-07-08 09:19:11 +08:00
Kevin Ballard
f7d0c4b065
Add a test case for switch error code (issue #161 )
2012-06-24 13:43:44 -07:00