citrus_test 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- data.tar.gz.sig +0 -0
- data/lib/citrus_test.rb +19 -9
- metadata +60 -62
- metadata.gz.sig +0 -0
data.tar.gz.sig
CHANGED
Binary file
|
data/lib/citrus_test.rb
CHANGED
@@ -13,6 +13,16 @@ class GrammarTest < Test::Unit::TestCase
|
|
13
13
|
caller_dir = File.dirname(/\A(.*?):\d+:in `.*'\z/.match(caller[0])[1])
|
14
14
|
class_variable_set(:@@grammar_dir, File.absolute_path(gd, caller_dir))
|
15
15
|
end
|
16
|
+
|
17
|
+
# Load the grammar specified by grammar. If force is true, we will bypass
|
18
|
+
# Citrus' internal cache.
|
19
|
+
def load_grammar(grammar, force=false)
|
20
|
+
loc = File.join(@@grammar_dir, grammar+".citrus")
|
21
|
+
|
22
|
+
Citrus.cache.delete(loc) if force
|
23
|
+
|
24
|
+
Citrus.load(loc)
|
25
|
+
end
|
16
26
|
end
|
17
27
|
|
18
28
|
# Set the name of the grammar our subclass uses on the basis of its mangled
|
@@ -60,24 +70,25 @@ class GrammarTest < Test::Unit::TestCase
|
|
60
70
|
# attributes. (If you want to actually assert that the result *is* a hash, try
|
61
71
|
# using :to_hash as a key.)
|
62
72
|
def assert_parses(rule, str, attributes={})
|
63
|
-
|
73
|
+
err_prefix = "error in parsing #{str.inspect} with #{@@grammar}.#{rule}: "
|
64
74
|
|
65
75
|
ret = nil
|
66
|
-
assert_nothing_raised(
|
76
|
+
assert_nothing_raised(err_prefix + "invalid syntax") do
|
67
77
|
ret = parse(rule, str)
|
68
78
|
end
|
69
79
|
|
70
80
|
if attributes.is_a?(Hash)
|
71
81
|
attributes.each do |attr, expected_val|
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
82
|
+
a = "attribute #{attr}"
|
83
|
+
assert(ret.respond_to?(attr), err_prefix + "#{a} doesn't exist")
|
84
|
+
fetch_err = "An exception was raised when fetching #{a}"
|
85
|
+
assert_nothing_raised(err_prefix + fetch_err) do
|
86
|
+
wrong_val_err = "#{a} has an unexpected value"
|
87
|
+
assert_equal(expected_val, ret.send(attr), err_prefix + wrong_val_err)
|
77
88
|
end
|
78
89
|
end
|
79
90
|
else
|
80
|
-
assert_equal(attributes, ret,
|
91
|
+
assert_equal(attributes, ret, err_prefix + "unexpected value")
|
81
92
|
end
|
82
93
|
|
83
94
|
ret
|
@@ -90,4 +101,3 @@ class GrammarTest < Test::Unit::TestCase
|
|
90
101
|
assert_raises(Citrus::ParseError, msg){ rule(rule).parse(str) }
|
91
102
|
end
|
92
103
|
end
|
93
|
-
|
metadata
CHANGED
@@ -1,114 +1,112 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: citrus_test
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
|
6
|
-
- 0
|
7
|
-
- 1
|
8
|
-
- 2
|
9
|
-
version: 0.1.2
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.3
|
5
|
+
prerelease:
|
10
6
|
platform: ruby
|
11
|
-
authors:
|
7
|
+
authors:
|
12
8
|
- katmagic
|
13
9
|
autorequire:
|
14
10
|
bindir: bin
|
15
|
-
cert_chain:
|
16
|
-
-
|
17
|
-
|
11
|
+
cert_chain:
|
12
|
+
- ! '-----BEGIN CERTIFICATE-----
|
13
|
+
|
18
14
|
MIIDQDCCAiigAwIBAgIBADANBgkqhkiG9w0BAQUFADBGMRgwFgYDVQQDDA90aGUu
|
15
|
+
|
19
16
|
bWFnaWNhbC5rYXQxFTATBgoJkiaJk/IsZAEZFgVnbWFpbDETMBEGCgmSJomT8ixk
|
17
|
+
|
20
18
|
ARkWA2NvbTAeFw0xMTA4MjEyMjMyMDFaFw0xMjA4MjAyMjMyMDFaMEYxGDAWBgNV
|
19
|
+
|
21
20
|
BAMMD3RoZS5tYWdpY2FsLmthdDEVMBMGCgmSJomT8ixkARkWBWdtYWlsMRMwEQYK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|
47
|
+
|
35
48
|
Zn3u2leVae/fJ03zYGArhuJKPgc=
|
49
|
+
|
36
50
|
-----END CERTIFICATE-----
|
37
51
|
|
38
|
-
|
39
|
-
|
40
|
-
dependencies:
|
41
|
-
- !ruby/object:Gem::Dependency
|
52
|
+
'
|
53
|
+
date: 2011-11-10 00:00:00.000000000 Z
|
54
|
+
dependencies:
|
55
|
+
- !ruby/object:Gem::Dependency
|
42
56
|
name: rake
|
43
|
-
|
44
|
-
requirement: &id001 !ruby/object:Gem::Requirement
|
57
|
+
requirement: &81927380 !ruby/object:Gem::Requirement
|
45
58
|
none: false
|
46
|
-
requirements:
|
47
|
-
- -
|
48
|
-
- !ruby/object:Gem::Version
|
49
|
-
|
50
|
-
- 0
|
51
|
-
version: "0"
|
59
|
+
requirements:
|
60
|
+
- - ! '>='
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
version: '0'
|
52
63
|
type: :development
|
53
|
-
version_requirements: *id001
|
54
|
-
- !ruby/object:Gem::Dependency
|
55
|
-
name: citrus
|
56
64
|
prerelease: false
|
57
|
-
|
65
|
+
version_requirements: *81927380
|
66
|
+
- !ruby/object:Gem::Dependency
|
67
|
+
name: citrus
|
68
|
+
requirement: &81926610 !ruby/object:Gem::Requirement
|
58
69
|
none: false
|
59
|
-
requirements:
|
60
|
-
- -
|
61
|
-
- !ruby/object:Gem::Version
|
62
|
-
|
63
|
-
- 0
|
64
|
-
version: "0"
|
70
|
+
requirements:
|
71
|
+
- - ! '>='
|
72
|
+
- !ruby/object:Gem::Version
|
73
|
+
version: '0'
|
65
74
|
type: :runtime
|
66
|
-
|
75
|
+
prerelease: false
|
76
|
+
version_requirements: *81926610
|
67
77
|
description: citrus_test makes it easier to test Citrus grammars.
|
68
78
|
email: the.magical.kat@gmail.com
|
69
79
|
executables: []
|
70
|
-
|
71
80
|
extensions: []
|
72
|
-
|
73
81
|
extra_rdoc_files: []
|
74
|
-
|
75
|
-
files:
|
82
|
+
files:
|
76
83
|
- lib/citrus_test.rb
|
77
84
|
- UNLICENSE
|
78
85
|
- README.md
|
79
|
-
has_rdoc: true
|
80
86
|
homepage: https://github.com/katmagic/citrus_test
|
81
|
-
licenses:
|
87
|
+
licenses:
|
82
88
|
- Public Domain
|
83
89
|
post_install_message:
|
84
90
|
rdoc_options: []
|
85
|
-
|
86
|
-
require_paths:
|
91
|
+
require_paths:
|
87
92
|
- lib
|
88
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
93
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
89
94
|
none: false
|
90
|
-
requirements:
|
91
|
-
- -
|
92
|
-
- !ruby/object:Gem::Version
|
93
|
-
|
94
|
-
|
95
|
-
- 9
|
96
|
-
- 2
|
97
|
-
version: 1.9.2
|
98
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
95
|
+
requirements:
|
96
|
+
- - ! '>='
|
97
|
+
- !ruby/object:Gem::Version
|
98
|
+
version: '0'
|
99
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
99
100
|
none: false
|
100
|
-
requirements:
|
101
|
-
- -
|
102
|
-
- !ruby/object:Gem::Version
|
103
|
-
|
104
|
-
- 0
|
105
|
-
version: "0"
|
101
|
+
requirements:
|
102
|
+
- - ! '>='
|
103
|
+
- !ruby/object:Gem::Version
|
104
|
+
version: '0'
|
106
105
|
requirements: []
|
107
|
-
|
108
106
|
rubyforge_project: citrus_test
|
109
|
-
rubygems_version: 1.
|
107
|
+
rubygems_version: 1.8.10
|
110
108
|
signing_key:
|
111
109
|
specification_version: 3
|
112
110
|
summary: citrus_test makes it easier to test Citrus grammars.
|
113
111
|
test_files: []
|
114
|
-
|
112
|
+
has_rdoc:
|
metadata.gz.sig
CHANGED
Binary file
|