Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement test -v and test -k #537

Closed
BatmanAoD opened this issue Nov 18, 2019 · 7 comments
Closed

Implement test -v and test -k #537

BatmanAoD opened this issue Nov 18, 2019 · 7 comments

Comments

@BatmanAoD
Copy link
Contributor

I discovered test -v isn't implemented, and couldn't find an existing issue for it.

Here's a table of the "primary expressions" that Bash's test supports:

http://www.tldp.org/LDP/Bash-Beginners-Guide/html/sect_07_01.html#tab_07_01

Of the unary primary expresions (such as -v VAR), -v is the only one that prints an error saying that it isn't implemented, but test -k foo prints:

(test) Expected unary operator, got '-k' (2 args)
@andychu
Copy link
Contributor

andychu commented Nov 18, 2019

Did you encounter a script that uses these? Or were you just testing?

All this stuff should be eventually implemented, but unless it adds something here [1] it wouldn't be at the top of my TODO list.

My strategy now is to make Oil faster / usable / desirable and hopefully users will be motivated to fill out all the corners :) Patches are accepted :)

[1] https://github.com/oilshell/oil/wiki/Shell-Programs-That-Run-Under-OSH

@BatmanAoD
Copy link
Contributor Author

I have -v in my personal config setup (because the alternative is ugly and confusing), but I'll remove it. I haven't yet encountered -k, but I thought it might be helpful to just run through the table quickly.

Keeping this low-priority is absolutely fine with me! I expect -v would be nearly trivial to implement, but I don't have a source check-out at the moment, just a release tarball.

@BatmanAoD
Copy link
Contributor Author

In case you're interested, here are some other errors from trying to source my Bash setup: https://github.com/BatmanAoD/PublicPaste/blob/master/OshWithPubConfig.log

As you can see at the bottom, it fails to source most of my setup, so I'm sure there's quite a bit more that's missing.

@andychu
Copy link
Contributor

andychu commented Nov 18, 2019

OK thanks, that looks about what I'd expect.

  • a bunch of shell options not implemented (sometimes we stub these out. We could do that, although I'm not sure if that's the best havior)
  • ${=1} is actually a zsh thing, but OSH does static parsing and finds the invalid syntax! It's possible we could special case that since I know git-completion is all over the place.
  • I thought we had a stub for the bind builtin, but it's limited
  • The extended globs only work in patten matching (fnmatch), not glob. That one is actually a bit hard to change.

@BatmanAoD
Copy link
Contributor Author

BatmanAoD commented Nov 18, 2019

  • The extended globs only work in patten matching (fnmatch), not glob. That one is actually a bit hard to change.

That's unfortunate; that's probably the only feature of the ones listed that I would actually miss if I transitioned away from Bash, because I use negative matching in my shell from time to time.

@andychu
Copy link
Contributor

andychu commented Mar 9, 2020

test -k and test -v will be out with the next release

@akinomyoga

@andychu
Copy link
Contributor

andychu commented Mar 25, 2020

@andychu andychu closed this as completed Mar 25, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants