You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Note that all of the switches test works on require another argument. test -f with no more arguments is not checking for a file or going to report an error about a missing argument. It's returning 0 because -f is not empty.
Would it really break existing uses, though? All of our other builtins require -- to allow parameters that look like switches; here we would only be special-casing a single switch, and we can allow for -- to separate payloads from parameters, if needed.
Activity
floam commentedon Sep 14, 2019
This is by design.
test $xreturns 0 ifxis not empty. "--help" is not empty. It would break compatibility with POSIX test and existing uses in fish.floam commentedon Sep 14, 2019
Note that all of the switches
testworks on require another argument.test -fwith no more arguments is not checking for a file or going to report an error about a missing argument. It's returning 0 because-fis not empty.mqudsi commentedon Sep 18, 2019
Would it really break existing uses, though? All of our other builtins require
--to allow parameters that look like switches; here we would only be special-casing a single switch, and we can allow for--to separate payloads from parameters, if needed.faho commentedon Sep 18, 2019
Yes, it would.
testfundamentally sucks, let's not try to paint lipstick on a pig.faho commentedon Sep 19, 2019
In particular,
testdoes not support--.So because this necessitates a compatibility break, let's close this. Personally, I'd recommend looking for alternatives to test instead.