fabulator 0.0.1 → 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/History.txt +10 -0
- data/Rakefile +50 -39
- data/VERSION +1 -0
- data/features/functions.feature +164 -0
- data/features/group-params.feature +86 -0
- data/features/loops.feature +55 -0
- data/features/paths.feature +57 -0
- data/features/primitives.feature +9 -0
- data/features/simple-control.feature +13 -0
- data/features/simple-math.feature +18 -0
- data/features/simple-statemachine.feature +192 -0
- data/features/step_definitions/expression_steps.rb +102 -0
- data/features/step_definitions/template_steps.rb +25 -0
- data/features/step_definitions/xml_steps.rb +23 -0
- data/features/support/env.rb +7 -0
- data/features/templates.feature +100 -0
- data/features/types.feature +64 -0
- data/features/xsm-inheritance.feature +46 -0
- data/init.rb +6 -0
- data/lib/fabulator/action_lib.rb +31 -1
- data/lib/fabulator/core/actions.rb +5 -5
- data/lib/fabulator/core/state_machine.rb +7 -4
- data/lib/fabulator/expr/function.rb +3 -0
- data/lib/fabulator/expr/function.rb.old +85 -0
- data/lib/fabulator/expr/parser.rb +7 -3
- data/lib/fabulator/template/parse_result.rb +8 -10
- data/xsm_expression_parser.racc +462 -0
- metadata +32 -48
data/History.txt
CHANGED
@@ -2,3 +2,13 @@
|
|
2
2
|
|
3
3
|
* 1 major enhancement:
|
4
4
|
* Initial release
|
5
|
+
|
6
|
+
=== 0.0.2 2010-08-10
|
7
|
+
|
8
|
+
* 3 major enhancement:
|
9
|
+
* Introduce '*' suffix to indicate a consolidation of a reduction
|
10
|
+
* Reduction functions can now have a corresponding consolidation
|
11
|
+
function. The reduction will be a fallback for an undefined
|
12
|
+
consolidation.
|
13
|
+
* Use LibXSLT to apply template to html transform (requires the
|
14
|
+
libxslt-ruby gem)
|
data/Rakefile
CHANGED
@@ -1,48 +1,40 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
gem
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
#
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
self.developer 'James Smith', 'jgsmith@tamu.edu'
|
18
|
-
self.post_install_message = 'PostInstall.txt' # TODO remove if post-install message not required
|
19
|
-
self.rubyforge_name = self.name # TODO this is default value
|
20
|
-
# self.extra_deps = [['activesupport','>= 2.0.2']]
|
21
|
-
|
1
|
+
begin
|
2
|
+
require 'jeweler'
|
3
|
+
Jeweler::Tasks.new do |gem|
|
4
|
+
gem.name = "fabulator"
|
5
|
+
gem.summary = %Q{XML-based state machine description language and engine.}
|
6
|
+
gem.description = %Q{The fabulator library provides a state machine implementation of a core set of semantics for building data-driven applications using a simple XML language coupled with an XQuery-like expression language.}
|
7
|
+
gem.email = "jgsmith@tamu.edu"
|
8
|
+
gem.homepage = "http://github.com/jgsmith/ruby-fabulator"
|
9
|
+
gem.authors = ["James Smith"]
|
10
|
+
gem.add_dependency(%q<libxml-ruby>, [">= 1.1.3"])
|
11
|
+
gem.add_dependency(%q<libxslt-ruby>, [">= 0.9.7"])
|
12
|
+
gem.add_dependency(%q<radius>, [">= 0.6.1"])
|
13
|
+
# gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
|
14
|
+
end
|
15
|
+
rescue LoadError
|
16
|
+
puts "Jeweler (or a dependency) not available. This is only required if you plan to package fabulator-exhibit as a gem."
|
22
17
|
end
|
23
18
|
|
24
|
-
require '
|
25
|
-
|
19
|
+
require 'rake'
|
20
|
+
require 'rake/rdoctask'
|
21
|
+
require 'rake/testtask'
|
26
22
|
|
27
|
-
|
28
|
-
|
29
|
-
# task :default => [:spec, :features]
|
23
|
+
require 'cucumber'
|
24
|
+
require 'cucumber/rake/task'
|
30
25
|
|
31
|
-
|
32
|
-
task :todo do
|
33
|
-
egrep /(FIXME|TODO|TBD)/
|
34
|
-
end
|
26
|
+
task :features => 'spec:integration'
|
35
27
|
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
end
|
28
|
+
namespace :spec do
|
29
|
+
|
30
|
+
desc "Run the Cucumber features"
|
31
|
+
Cucumber::Rake::Task.new(:integration) do |t|
|
32
|
+
t.fork = true
|
33
|
+
t.cucumber_opts = ['--format', (ENV['CUCUMBER_FORMAT'] || 'pretty')]
|
34
|
+
# t.feature_pattern = "#{extension_root}/features/**/*.feature"
|
35
|
+
t.profile = "default"
|
45
36
|
end
|
37
|
+
|
46
38
|
end
|
47
39
|
|
48
40
|
namespace :update do
|
@@ -52,3 +44,22 @@ namespace :update do
|
|
52
44
|
end
|
53
45
|
end
|
54
46
|
|
47
|
+
desc 'Generate documentation for the fabulator exhibit extension.'
|
48
|
+
Rake::RDocTask.new(:rdoc) do |rdoc|
|
49
|
+
rdoc.rdoc_dir = 'rdoc'
|
50
|
+
rdoc.title = 'Fabulator'
|
51
|
+
rdoc.options << '--line-numbers' << '--inline-source'
|
52
|
+
rdoc.rdoc_files.include('README')
|
53
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
54
|
+
end
|
55
|
+
|
56
|
+
# For extensions that are in transition
|
57
|
+
desc 'Test the fabulator exhibit extension.'
|
58
|
+
Rake::TestTask.new(:test) do |t|
|
59
|
+
t.libs << 'lib'
|
60
|
+
t.pattern = 'test/**/*_test.rb'
|
61
|
+
t.verbose = true
|
62
|
+
end
|
63
|
+
|
64
|
+
# Load any custom rakefiles for extension
|
65
|
+
Dir[File.dirname(__FILE__) + '/tasks/*.rake'].sort.each { |f| require f }
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.0.2
|
@@ -0,0 +1,164 @@
|
|
1
|
+
@func
|
2
|
+
Feature: Function calls and lists
|
3
|
+
|
4
|
+
Scenario: Adding two numbers together as a union
|
5
|
+
Given a context
|
6
|
+
And the prefix f as "http://dh.tamu.edu/ns/fabulator/1.0#"
|
7
|
+
When I run the expression (f:sum((1 | 2)))
|
8
|
+
Then I should get 1 item
|
9
|
+
And item 0 should be [3]
|
10
|
+
|
11
|
+
@cons
|
12
|
+
Scenario: Adding two numbers together as a union with sum consolidation
|
13
|
+
Given a context
|
14
|
+
And the prefix f as "http://dh.tamu.edu/ns/fabulator/1.0#"
|
15
|
+
When I run the expression (f:sum*((1 | 2)))
|
16
|
+
Then I should get 1 item
|
17
|
+
And item 0 should be [3]
|
18
|
+
|
19
|
+
@cons
|
20
|
+
Scenario: Adding two numbers together as a union with count consolidation
|
21
|
+
Given a context
|
22
|
+
And the prefix f as "http://dh.tamu.edu/ns/fabulator/1.0#"
|
23
|
+
When I run the expression (f:count*((1 | 2)))
|
24
|
+
Then I should get 1 item
|
25
|
+
And item 0 should be [3]
|
26
|
+
|
27
|
+
Scenario: Adding two numbers together as a list
|
28
|
+
Given a context
|
29
|
+
And the prefix f as "http://dh.tamu.edu/ns/fabulator/1.0#"
|
30
|
+
When I run the expression (f:sum((1, 2)))
|
31
|
+
Then I should get 1 item
|
32
|
+
And item 0 should be [3]
|
33
|
+
|
34
|
+
Scenario: Adding number of elements in a histogram, part 1
|
35
|
+
Given a context
|
36
|
+
And the prefix f as "http://dh.tamu.edu/ns/fabulator/1.0#"
|
37
|
+
When I run the expression (let $i := (1 .. 6) + (1 .. 6); f:sum($i))
|
38
|
+
Then I should get 1 item
|
39
|
+
And item 0 should be [6*6*7]
|
40
|
+
|
41
|
+
Scenario: Adding number of elements in a histogram, part 2
|
42
|
+
Given a context
|
43
|
+
And the prefix f as "http://dh.tamu.edu/ns/fabulator/1.0#"
|
44
|
+
When I run the expression (let $i := (1 .. 6) + (1 .. 6); f:sum(f:histogram($i)/*))
|
45
|
+
Then I should get 1 item
|
46
|
+
And item 0 should be [6*6]
|
47
|
+
|
48
|
+
Scenario: Split a string
|
49
|
+
Given a context
|
50
|
+
And the prefix f as "http://dh.tamu.edu/ns/fabulator/1.0#"
|
51
|
+
When I run the expression (let $t := "The quick brown fox jumped over the brown spotted cow"; f:split($t, " "))
|
52
|
+
Then I should get 10 items
|
53
|
+
And item 0 should be ['The']
|
54
|
+
And item 1 should be ['quick']
|
55
|
+
|
56
|
+
Scenario: Histogram of text
|
57
|
+
Given a context
|
58
|
+
And the prefix f as "http://dh.tamu.edu/ns/fabulator/1.0#"
|
59
|
+
When I run the expression (let $t := "The quick brown fox jumped over the brown spotted cow"; f:histogram(f:split($t, " "))/brown)
|
60
|
+
Then I should get 1 item
|
61
|
+
And item 0 should be [2]
|
62
|
+
|
63
|
+
@hist
|
64
|
+
Scenario: Histogram of text
|
65
|
+
Given a context
|
66
|
+
And the prefix f as "http://dh.tamu.edu/ns/fabulator/1.0#"
|
67
|
+
When I run the expression (let $t := f:lower-case("The quick brown fox jumped over the brown spotted cow"); f:histogram*( (f:histogram(f:split($t, " ")), f:histogram(f:split($t, " "))) )/brown)
|
68
|
+
Then I should get 1 item
|
69
|
+
And item 0 should be [4]
|
70
|
+
|
71
|
+
@hist
|
72
|
+
Scenario: Histogram of text with attributes
|
73
|
+
Given a context
|
74
|
+
And the prefix f as "http://dh.tamu.edu/ns/fabulator/1.0#"
|
75
|
+
When I run the expression (let $t := f:lower-case("The quick brown fox jumped over the brown spotted cow"); f:histogram*( ( (f:histogram(f:split($t, " ")) with ./*/@line := 1), (f:histogram(f:split($t, " ")) with ./*/@line := 2)) )/brown)
|
76
|
+
Then I should get 1 item
|
77
|
+
And item 0 should be [4]
|
78
|
+
|
79
|
+
Scenario: Joining a range of numbers
|
80
|
+
Given a context
|
81
|
+
And the prefix f as "http://dh.tamu.edu/ns/fabulator/1.0#"
|
82
|
+
When I run the expression (let $i := 5; (1 .. $i))
|
83
|
+
Then I should get 5 item
|
84
|
+
And item 0 should be [1]
|
85
|
+
And item 1 should be [2]
|
86
|
+
And item 2 should be [3]
|
87
|
+
And item 3 should be [4]
|
88
|
+
And item 4 should be [5]
|
89
|
+
|
90
|
+
Scenario: Joining a range of numbers
|
91
|
+
Given a context
|
92
|
+
And the prefix f as "http://dh.tamu.edu/ns/fabulator/1.0#"
|
93
|
+
When I run the expression (let $i := 5; f:sum((1 .. $i)))
|
94
|
+
Then I should get 1 item
|
95
|
+
And item 0 should be [15]
|
96
|
+
|
97
|
+
Scenario: Joining a range of numbers
|
98
|
+
Given a context
|
99
|
+
And the prefix f as "http://dh.tamu.edu/ns/fabulator/1.0#"
|
100
|
+
When I run the expression (f:string-join( (1 .. 5), ','))
|
101
|
+
Then I should get 1 item
|
102
|
+
And item 0 should be ["1,2,3,4,5"]
|
103
|
+
|
104
|
+
Scenario: Joining a range of numbers
|
105
|
+
Given a context
|
106
|
+
And the prefix f as "http://dh.tamu.edu/ns/fabulator/1.0#"
|
107
|
+
When I run the expression (let $i := 5; f:string-join( (1 .. $i), ','))
|
108
|
+
Then I should get 1 item
|
109
|
+
And item 0 should be ["1,2,3,4,5"]
|
110
|
+
|
111
|
+
Scenario Outline: simple functions
|
112
|
+
Given a context
|
113
|
+
And the prefix f as "http://dh.tamu.edu/ns/fabulator/1.0#"
|
114
|
+
When I run the expression (f:<fctn>(<a>))
|
115
|
+
Then I should get 1 item
|
116
|
+
And item 0 should be [<ans>]
|
117
|
+
|
118
|
+
Examples:
|
119
|
+
| fctn | a | ans |
|
120
|
+
| abs | -1 | 1 |
|
121
|
+
| abs | 1 | 1 |
|
122
|
+
| abs | 0 | 0 |
|
123
|
+
| floor | 1.23 | 1 |
|
124
|
+
| ceiling | 1.23 | 2 |
|
125
|
+
| sum | (1,2) | 3 |
|
126
|
+
| avg | (1,2,3) | 2 |
|
127
|
+
| max | (2,3,1) | 3 |
|
128
|
+
| min | (3,1,2) | 1 |
|
129
|
+
|
130
|
+
Scenario: boolean constant functions - true
|
131
|
+
Given a context
|
132
|
+
And the prefix f as "http://dh.tamu.edu/ns/fabulator/1.0#"
|
133
|
+
When I run the expression (f:true())
|
134
|
+
Then I should get 1 item
|
135
|
+
And item 0 should be true
|
136
|
+
|
137
|
+
Scenario: boolean constant functions - false
|
138
|
+
Given a context
|
139
|
+
And the prefix f as "http://dh.tamu.edu/ns/fabulator/1.0#"
|
140
|
+
When I run the expression (f:false())
|
141
|
+
Then I should get 1 item
|
142
|
+
And item 0 should be false
|
143
|
+
|
144
|
+
Scenario: Replacing unwanted characters in a string
|
145
|
+
Given a context
|
146
|
+
And the prefix f as "http://dh.tamu.edu/ns/fabulator/1.0#"
|
147
|
+
When I run the expression (f:keep("foo bar baz! ter", ('alpha', 'space', 'numeric')))
|
148
|
+
Then I should get 1 item
|
149
|
+
And item 0 should be ['foo bar baz ter']
|
150
|
+
|
151
|
+
Scenario: Replacing unwanted characters in a string
|
152
|
+
Given a context
|
153
|
+
And the prefix f as "http://dh.tamu.edu/ns/fabulator/1.0#"
|
154
|
+
When I run the expression (f:keep("foo bar baz! ter", ('alpha', 'numeric')))
|
155
|
+
Then I should get 1 item
|
156
|
+
And item 0 should be ['foo bar baz ter']
|
157
|
+
|
158
|
+
@bool
|
159
|
+
Scenario: Negating logic
|
160
|
+
Given a context
|
161
|
+
And the prefix f as "http://dh.tamu.edu/ns/fabulator/1.0#"
|
162
|
+
When I run the expression (f:not(f:true()))
|
163
|
+
Then I should get 1 item
|
164
|
+
And item 0 should be [f:false()]
|
@@ -0,0 +1,86 @@
|
|
1
|
+
@group
|
2
|
+
Feature: Groups/Parameters
|
3
|
+
|
4
|
+
Scenario: simple machine with a simple transition and filter
|
5
|
+
Given the statemachine
|
6
|
+
"""
|
7
|
+
<f:application xmlns:f="http://dh.tamu.edu/ns/fabulator/1.0#">
|
8
|
+
<f:view f:name="start">
|
9
|
+
<f:goes-to f:view="stop">
|
10
|
+
<f:params>
|
11
|
+
<f:param f:name="foo">
|
12
|
+
<f:filter f:name="trim" />
|
13
|
+
</f:param>
|
14
|
+
</f:params>
|
15
|
+
</f:goes-to>
|
16
|
+
</f:view>
|
17
|
+
<f:view f:name="stop" />
|
18
|
+
</f:application>
|
19
|
+
"""
|
20
|
+
Then it should be in the 'start' state
|
21
|
+
When I run it with the following params:
|
22
|
+
| key | value |
|
23
|
+
| foo | bar b que |
|
24
|
+
Then it should be in the 'stop' state
|
25
|
+
And the expression (/foo) should equal ['bar b que']
|
26
|
+
|
27
|
+
Scenario: simple machine with a simple transition and simple value constraint
|
28
|
+
Given the statemachine
|
29
|
+
"""
|
30
|
+
<f:application xmlns:f="http://dh.tamu.edu/ns/fabulator/1.0#">
|
31
|
+
<f:view f:name="start">
|
32
|
+
<f:goes-to f:view="stop">
|
33
|
+
<f:params>
|
34
|
+
<f:param f:name="foo">
|
35
|
+
<f:filter f:name="trim" />
|
36
|
+
<f:value>bar</f:value>
|
37
|
+
</f:param>
|
38
|
+
</f:params>
|
39
|
+
</f:goes-to>
|
40
|
+
</f:view>
|
41
|
+
<f:view f:name="stop" />
|
42
|
+
</f:application>
|
43
|
+
"""
|
44
|
+
Then it should be in the 'start' state
|
45
|
+
When I run it with the following params:
|
46
|
+
| key | value |
|
47
|
+
| foo | bar b que |
|
48
|
+
Then it should be in the 'start' state
|
49
|
+
And the expression (/foo) should be nil
|
50
|
+
When I run it with the following params:
|
51
|
+
| key | value |
|
52
|
+
| foo | bar |
|
53
|
+
Then it should be in the 'stop' state
|
54
|
+
And the expression (/foo) should equal ['bar']
|
55
|
+
|
56
|
+
Scenario: simple machine with a simple transition and simple group
|
57
|
+
Given the statemachine
|
58
|
+
"""
|
59
|
+
<f:application xmlns:f="http://dh.tamu.edu/ns/fabulator/1.0#">
|
60
|
+
<f:view f:name="start">
|
61
|
+
<f:goes-to f:view="stop">
|
62
|
+
<f:params>
|
63
|
+
<f:group f:select="/bar">
|
64
|
+
<f:param f:name="foo">
|
65
|
+
<f:filter f:name="trim" />
|
66
|
+
<f:value>bar</f:value>
|
67
|
+
</f:param>
|
68
|
+
</f:group>
|
69
|
+
</f:params>
|
70
|
+
</f:goes-to>
|
71
|
+
</f:view>
|
72
|
+
<f:view f:name="stop" />
|
73
|
+
</f:application>
|
74
|
+
"""
|
75
|
+
Then it should be in the 'start' state
|
76
|
+
When I run it with the following params:
|
77
|
+
| key | value |
|
78
|
+
| bar.foo | bar b que |
|
79
|
+
Then it should be in the 'start' state
|
80
|
+
And the expression (/bar/foo) should be nil
|
81
|
+
When I run it with the following params:
|
82
|
+
| key | value |
|
83
|
+
| bar.foo | bar |
|
84
|
+
Then it should be in the 'stop' state
|
85
|
+
And the expression (/bar/foo) should equal ['bar']
|
86
|
+
|
@@ -0,0 +1,55 @@
|
|
1
|
+
Feature: Loops
|
2
|
+
|
3
|
+
Scenario: 'For' with a single variable
|
4
|
+
Given a context
|
5
|
+
When I run the expression (for $i in 1 .. 3 return $i)
|
6
|
+
Then I should get 3 items
|
7
|
+
And item 0 should be [1]
|
8
|
+
And item 1 should be [2]
|
9
|
+
And item 2 should be [3]
|
10
|
+
|
11
|
+
Scenario: 'Some' with a single variable
|
12
|
+
Given a context
|
13
|
+
When I run the expression (some $i in 1 .. 3 satisfies $i mod 2 = 1)
|
14
|
+
Then I should get 1 items
|
15
|
+
And item 0 should be true
|
16
|
+
|
17
|
+
Scenario: 'Every' with a single variable
|
18
|
+
Given a context
|
19
|
+
When I run the expression (every $i in 1 .. 3 satisfies $i mod 2 = 1)
|
20
|
+
Then I should get 1 items
|
21
|
+
And item 0 should be false
|
22
|
+
|
23
|
+
@for
|
24
|
+
Scenario: 'For' with two variables
|
25
|
+
Given a context
|
26
|
+
When I run the expression (for $i in 1 .. 3, $j in 2 to 4 return $i*$j)
|
27
|
+
Then I should get 9 items
|
28
|
+
|
29
|
+
@for
|
30
|
+
Scenario: 'For' within a sum
|
31
|
+
Given a context
|
32
|
+
And the prefix f as "http://dh.tamu.edu/ns/fabulator/1.0#"
|
33
|
+
When I run the expression (f:sum(for $i in 1 to 3, $j in 2 to 4 return $i*$j))
|
34
|
+
Then I should get 1 item
|
35
|
+
And item 0 should be [54]
|
36
|
+
|
37
|
+
@with
|
38
|
+
Scenario: 'For' with annotation
|
39
|
+
Given a context
|
40
|
+
And the prefix f as "http://dh.tamu.edu/ns/fabulator/1.0#"
|
41
|
+
When I run the expression (for $i in 1 to 3 return $i with ./line := 4)
|
42
|
+
Then I should get 3 items
|
43
|
+
And item 0 should be [1]
|
44
|
+
And item 1 should be [2]
|
45
|
+
And item 2 should be [3]
|
46
|
+
|
47
|
+
@with
|
48
|
+
Scenario: 'For' with annotation
|
49
|
+
Given a context
|
50
|
+
And the prefix f as "http://dh.tamu.edu/ns/fabulator/1.0#"
|
51
|
+
When I run the expression ((for $i in 1 to 3 return $i with ./line := 4)/line)
|
52
|
+
Then I should get 3 items
|
53
|
+
And item 0 should be [4]
|
54
|
+
And item 1 should be [4]
|
55
|
+
And item 2 should be [4]
|
@@ -0,0 +1,57 @@
|
|
1
|
+
@paths
|
2
|
+
Feature: Path expressions
|
3
|
+
|
4
|
+
Scenario: Finding the numbers
|
5
|
+
Given a context
|
6
|
+
And that [/a] is set to [1 .. 10]
|
7
|
+
When I run the expression (/a)
|
8
|
+
Then I should get 10 items
|
9
|
+
|
10
|
+
Scenario: Finding the positive numbers
|
11
|
+
Given a context
|
12
|
+
And that [/a] is set to [-1 .. 10]
|
13
|
+
When I run the expression (/a[. > 0])
|
14
|
+
Then I should get 10 items
|
15
|
+
|
16
|
+
Scenario: Finding the odd numbers
|
17
|
+
Given a context
|
18
|
+
And that [/a] is set to [1 .. 10]
|
19
|
+
When I run the expression (/a[. mod 2 = 1])
|
20
|
+
Then I should get 5 items
|
21
|
+
And item 0 should be [1]
|
22
|
+
And item 1 should be [3]
|
23
|
+
And item 2 should be [5]
|
24
|
+
And item 3 should be [7]
|
25
|
+
And item 4 should be [9]
|
26
|
+
|
27
|
+
Scenario: Finding the third odd number
|
28
|
+
Given a context
|
29
|
+
And that [/a] is set to [1 .. 10]
|
30
|
+
When I run the expression (/a[. mod 2 = 1][3])
|
31
|
+
Then I should get 1 item
|
32
|
+
And item 0 should be [5]
|
33
|
+
|
34
|
+
Scenario: Finding the third and fifth odd numbers
|
35
|
+
Given a context
|
36
|
+
And that [/a] is set to [1 .. 10]
|
37
|
+
When I run the expression (/a[. mod 2 = 1][3,5])
|
38
|
+
Then I should get 2 items
|
39
|
+
And item 0 should be [5]
|
40
|
+
And item 1 should be [9]
|
41
|
+
|
42
|
+
Scenario: Using an expression to name a node test
|
43
|
+
Given a context
|
44
|
+
And that [/a] is set to [1 .. 10]
|
45
|
+
And that [/b] is set to ['a']
|
46
|
+
When I run the expression (/{/b}[. mod 2 = 1][3,5])
|
47
|
+
Then I should get 2 items
|
48
|
+
And item 0 should be [5]
|
49
|
+
And item 1 should be [9]
|
50
|
+
|
51
|
+
Scenario: Using an expression to name a node test
|
52
|
+
Given a context
|
53
|
+
And that [/a] is set to [1 .. 10]
|
54
|
+
When I run the expression (/{'a'}[. mod 2 = 1][3,5])
|
55
|
+
Then I should get 2 items
|
56
|
+
And item 0 should be [5]
|
57
|
+
And item 1 should be [9]
|