Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 44 lines (35 sloc) 0.97 kB
c6d4b4b @mjackson Introduced compatibility with Ruby 1.9.2 rc2 (Thanks Simon Haydon). In
authored
1 require File.expand_path('../helper', __FILE__)
31e76f7 @mjackson Added AndPredicate and NotPredicate. Added Input class to manage curs…
authored
2
0731b28 @mjackson Added Labels. Nearing first stable release
authored
3 class NotPredicateTest < Test::Unit::TestCase
31e76f7 @mjackson Added AndPredicate and NotPredicate. Added Input class to manage curs…
authored
4 def test_terminal?
0731b28 @mjackson Added Labels. Nearing first stable release
authored
5 rule = NotPredicate.new
31e76f7 @mjackson Added AndPredicate and NotPredicate. Added Input class to manage curs…
authored
6 assert_equal(false, rule.terminal?)
7 end
8
456adbe @mjackson Introduced more lightweight parsing model
authored
9 def test_exec
10 rule = NotPredicate.new('abc')
11 events = rule.exec(Input.new('def'))
e924053 @mjackson Eliminate Rule id's
authored
12 assert_equal([rule, CLOSE, 0], events)
456adbe @mjackson Introduced more lightweight parsing model
authored
13 end
31e76f7 @mjackson Added AndPredicate and NotPredicate. Added Input class to manage curs…
authored
14
456adbe @mjackson Introduced more lightweight parsing model
authored
15 def test_exec_miss
16 rule = NotPredicate.new('abc')
17 events = rule.exec(Input.new('abc'))
18 assert_equal([], events)
19 end
31e76f7 @mjackson Added AndPredicate and NotPredicate. Added Input class to manage curs…
authored
20
456adbe @mjackson Introduced more lightweight parsing model
authored
21 def test_consumption
4ff6f59 @mjackson Fixed predicate consumption bug
authored
22 rule = NotPredicate.new(Sequence.new(['a', 'b', 'c']))
23
24 input = Input.new('abc')
25 events = rule.exec(input)
26 assert_equal(0, input.pos)
27
456adbe @mjackson Introduced more lightweight parsing model
authored
28 input = Input.new('def')
29 events = rule.exec(input)
30 assert_equal(0, input.pos)
31e76f7 @mjackson Added AndPredicate and NotPredicate. Added Input class to manage curs…
authored
31 end
32
33 def test_to_s
0731b28 @mjackson Added Labels. Nearing first stable release
authored
34 rule = NotPredicate.new('a')
31e76f7 @mjackson Added AndPredicate and NotPredicate. Added Input class to manage curs…
authored
35 assert_equal('!"a"', rule.to_s)
36 end
7f32be2 @mjackson Eliminate Label, Predicate, and List classes.
authored
37
38 def test_to_s_with_label
39 rule = NotPredicate.new('a')
40 rule.label = 'a_label'
41 assert_equal('a_label:!"a"', rule.to_s)
42 end
31e76f7 @mjackson Added AndPredicate and NotPredicate. Added Input class to manage curs…
authored
43 end
Something went wrong with that request. Please try again.