Browse files

Allow node names like Y*

This was a regression caused by
7bf95e8.
  • Loading branch information...
1 parent 7bf95e8 commit dde5fb8b3205f2f56a2864090a56d23ba8565085 @aroben committed Apr 4, 2012
Showing with 11 additions and 1 deletion.
  1. +1 −1 lib/asciidag.rb
  2. +10 −0 test/parser_test.rb
View
2 lib/asciidag.rb
@@ -174,7 +174,7 @@ def self.find_parents(position, nodes_by_position, lines)
continue_search.call(:initial, position, :either).flatten
end
- NODE_REGEXP = /\w'?/
+ NODE_REGEXP = /\w['*]?/
BRANCH_LABEL_REGEXP = /(?:(\w\w.*?)|"(.+?)")\s*$/
ARROW_REGEXP = /\s+(<--)\s+$/
PIXELS_PER_CHARACTER_X = 25
View
10 test/parser_test.rb
@@ -114,6 +114,10 @@
\ "topic"
o---o---o---o---o---o
EOF
+
+ @graph16 = AsciiDag.parse <<'EOF'
+ ---Z---o---X--...---o---A---o---o---Y*--...---o---B*--D*
+EOF
end
test 'parses nodes' do
@@ -283,4 +287,10 @@
master = find_branch_label @graph15, 'master'
assert_not_nil master
end
+
+ test 'should allow asterisks in node names' do
+ b = find_node @graph16, 'B*'
+ d = find_node @graph16, 'D*'
+ assert_equal [b], d.parents
+ end
end

0 comments on commit dde5fb8

Please sign in to comment.