Skip to content
This repository has been archived by the owner on Sep 13, 2017. It is now read-only.

Commit

Permalink
adding a test to find default regexp nodes.
Browse files Browse the repository at this point in the history
  • Loading branch information
tenderlove committed Sep 27, 2011
1 parent ba53081 commit e95aeac
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lib/journey/nodes/node.rb
Expand Up @@ -53,9 +53,14 @@ class Symbol < Terminal
attr_accessor :regexp attr_accessor :regexp
alias :symbol :regexp alias :symbol :regexp


DEFAULT_EXP = /[^\.\/\?]+/
def initialize left def initialize left
super super
@regexp = /[^\.\/\?]+/ @regexp = DEFAULT_EXP
end

def default_regexp?
regexp == DEFAULT_EXP
end end
end end


Expand Down
15 changes: 15 additions & 0 deletions test/nodes/test_symbol.rb
@@ -0,0 +1,15 @@
require 'helper'

module Journey
module Nodes
class TestSymbol < MiniTest::Unit::TestCase
def test_default_regexp?
sym = Symbol.new nil
assert sym.default_regexp?

sym.regexp = nil
refute sym.default_regexp?
end
end
end
end

0 comments on commit e95aeac

Please sign in to comment.