-
-
Notifications
You must be signed in to change notification settings - Fork 393
Add specs for reserved keywords #1187
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
base: master
Are you sure you want to change the base?
Changes from 2 commits
80f1817
2cc6546
0f54929
fde3d4b
62a023a
a1d7726
1e727ee
d6dec78
8cc2c02
618b860
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,155 @@ | ||||||
| require_relative '../spec_helper' | ||||||
|
|
||||||
| describe "Ruby's reserved keywords" do | ||||||
| # Copied from Prism::Translation::Ripper | ||||||
| keywords = [ | ||||||
|
||||||
| "alias", | ||||||
| "and", | ||||||
| "begin", | ||||||
| "BEGIN", | ||||||
| "break", | ||||||
| "case", | ||||||
| "class", | ||||||
| "def", | ||||||
| "defined?", | ||||||
| "do", | ||||||
| "else", | ||||||
| "elsif", | ||||||
| "end", | ||||||
| "END", | ||||||
| "ensure", | ||||||
| "false", | ||||||
| "for", | ||||||
| "if", | ||||||
| "in", | ||||||
| "module", | ||||||
| "next", | ||||||
| "nil", | ||||||
| "not", | ||||||
| "or", | ||||||
| "redo", | ||||||
| "rescue", | ||||||
| "retry", | ||||||
| "return", | ||||||
| "self", | ||||||
| "super", | ||||||
| "then", | ||||||
| "true", | ||||||
| "undef", | ||||||
| "unless", | ||||||
| "until", | ||||||
| "when", | ||||||
| "while", | ||||||
| "yield", | ||||||
| "__ENCODING__", | ||||||
| "__FILE__", | ||||||
| "__LINE__" | ||||||
| ] | ||||||
|
|
||||||
| keywords.each do |kw| | ||||||
|
||||||
| keywords.each do |kw| | |
| keywords.each do |name| |
kw feels too confusing here, especially since there is a spec about keyword arguments below.
Since we are mostly testing names for variables/methods, name seems clearer in usages.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mmmmm I disagree, in a spec focused on describing the behaviour of keywords, I would expect "keyword" to a be prominent term. It's an overloaded term, but that's just how Ruby is already. Perhaps keyword is better than kw?
Anyway, I renamed to name
Uh oh!
There was an error while loading. Please reload this page.