Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
make sure that all nodes are known for AST::Processor. (#698)
- Loading branch information
1 parent
54da73c
commit cbbb6bb
Showing
2 changed files
with
33 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# frozen_string_literal: true | ||
|
||
require 'helper' | ||
|
||
class TestASTProcessor < Minitest::Test | ||
LEAF_NODES = %i[ | ||
sym str int float complex rational | ||
true false nil self | ||
__FILE__ __LINE__ __ENCODING__ | ||
cbase regopt zsuper | ||
match_with_trailing_comma match_nil_pattern | ||
forward_args forwarded_args numargs kwnilarg | ||
objc_varargs objc_restarg objc_kwarg | ||
ident | ||
].freeze | ||
|
||
def setup | ||
@traversible = Parser::AST::Processor | ||
.instance_methods(false) | ||
.map { |mid| mid.to_s.scan(/\Aon_(.*)/) } | ||
.flatten | ||
.map(&:to_sym) | ||
|
||
@traversible += LEAF_NODES | ||
end | ||
|
||
def test_nodes_are_traversible | ||
for_each_node do |node| | ||
assert_includes @traversible, node.type | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters