test/functional/iterate.yml in uttk-0.3.6.1 vs test/functional/iterate.yml in uttk-0.4.5.0
- old
+ new
@@ -69,17 +69,45 @@
test: |
assert_equal(@symtbl[:ref_results], @symtbl[:results])
- Iterate can deal with many structures: !S::Suite
symbols:
- results: []
+ ref_results:
+ - "[1]"
+ - "[3]"
+ - "[7]"
+ - "[1042]"
+ - "[\"p\"]"
+ - "[\"q\"]"
+ - "[\"r\"]"
+ - !re "\[.*/fixtures/ball/(joe_i|qux_j|foo_s|bar_p)-mini-lib\.tar\.bz2\]"
+ - !re "\[.*/fixtures/ball/(joe_i|qux_j|foo_s|bar_p)-mini-lib\.tar\.bz2\]"
+ - !re "\[.*/fixtures/ball/(joe_i|qux_j|foo_s|bar_p)-mini-lib\.tar\.bz2\]"
+ - !re "\[.*/fixtures/ball/(joe_i|qux_j|foo_s|bar_p)-mini-lib\.tar\.bz2\]"
+ - !re "\[.*/fixtures/ball/(joe_i|qux_j|foo_s|bar_p)-mini-lib\.tar\.bz2, \"\1\"\]"
+ - !re "\[.*/fixtures/ball/(joe_i|qux_j|foo_s|bar_p)-mini-lib\.tar\.bz2, \"\1\"\]"
+ - !re "\[.*/fixtures/ball/(joe_i|qux_j|foo_s|bar_p)-mini-lib\.tar\.bz2, \"\1\"\]"
+ - !re "\[.*/fixtures/ball/(joe_i|qux_j|foo_s|bar_p)-mini-lib\.tar\.bz2, \"\1\"\]"
+ - !re "\[\"(foo|qux|bar)\", \"(bar|foo|baz)\"\]"
+ - !re "\[\"(foo|qux|bar)\", \"(bar|foo|baz)\"\]"
+ - !re "\[\"(foo|qux|bar)\", \"(bar|foo|baz)\"\]"
+ - "[2]"
+ - "[2]"
+ - "[2]"
attributes: !S::Iterate
iter: it
test:
- Iterate over many structures <<it:i>>: !S::Block
+ Iterate over many structures <<it:i>>: !S::Assert
test: |
- @symtbl[:results] << '<<*it>>'
+ ref = @symtbl[:ref_results].shift
+ my = '<<*it>>'
+ case ref
+ when Regexp
+ assert_match(ref, my)
+ else
+ assert_equal(ref, my)
+ end
contents:
- Iterate over arrays:
over: [1, 3, 7, 1042]
- Iterate over ranges:
over: !ruby "'p'..'r'" # FIXME !range
@@ -93,39 +121,5 @@
bar: baz
qux: foo
- Iterate over a Ruby value:
over: !ruby |
[2] * 3
-
- - Check the results contents: !S::Assert
- symbols:
- ref_results:
- - "[1]"
- - "[3]"
- - "[7]"
- - "[1042]"
- - "[\"p\"]"
- - "[\"q\"]"
- - "[\"r\"]"
- - !re ".*/fixtures/ball/joe_i-mini-lib\.tar\.bz2"
- - !re ".*/fixtures/ball/qux_j-mini-lib\.tar\.bz2"
- - !re ".*/fixtures/ball/foo_s-mini-lib\.tar\.bz2"
- - !re ".*/fixtures/ball/bar_p-mini-lib\.tar\.bz2"
- - !re ".*/fixtures/ball/joe_i-mini-lib\.tar\.bz2"
- - !re ".*/fixtures/ball/qux_j-mini-lib\.tar\.bz2"
- - !re ".*/fixtures/ball/foo_s-mini-lib\.tar\.bz2"
- - !re ".*/fixtures/ball/bar_p-mini-lib\.tar\.bz2"
- - !re "\[:(foo|qux|bar), \"(bar|foo|baz)\"\]"
- - !re "\[:(foo|qux|bar), \"(bar|foo|baz)\"\]"
- - !re "\[:(foo|qux|bar), \"(bar|foo|baz)\"\]"
- - "[2]"
- - "[2]"
- - "[2]"
- test: |
- for ref, my in @symtbl[:ref_results].zip @symtbl[:results] do
- case ref
- when Regexp
- assert_match(ref, my)
- else
- assert_equal(ref, my)
- end
- end