From 2eef485501417fb954acb2582e8f93e1b25573ac Mon Sep 17 00:00:00 2001 From: Vitalii Elenhaupt Date: Wed, 1 Nov 2017 01:06:47 +0200 Subject: [PATCH] AST traverse --- spec/ameba/ast_traverse_spec.cr | 18 ++++++++++++++++++ src/ameba/{ast.cr => ast_traverse.cr} | 0 2 files changed, 18 insertions(+) create mode 100644 spec/ameba/ast_traverse_spec.cr rename src/ameba/{ast.cr => ast_traverse.cr} (100%) diff --git a/spec/ameba/ast_traverse_spec.cr b/spec/ameba/ast_traverse_spec.cr new file mode 100644 index 00000000..5cec2da3 --- /dev/null +++ b/spec/ameba/ast_traverse_spec.cr @@ -0,0 +1,18 @@ +require "../spec_helper" + +module Ameba + rule = DummyRule.new + source = Source.new "" + + describe "AST Traverse" do + {% for name in NODE_VISITORS %} + describe "{{name}}" do + it "allow to visit {{name}} node" do + visitor = {{name}}Visitor.new rule, source + nodes = Crystal::Parser.new("").parse + nodes.accept visitor + end + end + {% end %} + end +end diff --git a/src/ameba/ast.cr b/src/ameba/ast_traverse.cr similarity index 100% rename from src/ameba/ast.cr rename to src/ameba/ast_traverse.cr