uttk 0.3.1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/AUTHORS +36 -0
- data/COPYING +18 -0
- data/ChangeLog +7673 -0
- data/GUIDELINES +86 -0
- data/LGPL +504 -0
- data/NEWS +158 -0
- data/NORM +137 -0
- data/README +180 -0
- data/Rakefile +8 -0
- data/SPEC.gemspec +15 -0
- data/SPEC.yml +60 -0
- data/TODO +23 -0
- data/TODO.old +31 -0
- data/VERSION +5 -0
- data/bin/getopts/uttk.rb +390 -0
- data/bin/uttk +188 -0
- data/bin/uttk-unit +125 -0
- data/lib/uttk.rb +288 -0
- data/lib/uttk/dumpers/Basic.rb +23 -0
- data/lib/uttk/dumpers/BasicColor.rb +35 -0
- data/lib/uttk/dumpers/Dumper.rb +77 -0
- data/lib/uttk/dumpers/Html.rb +271 -0
- data/lib/uttk/dumpers/Path.rb +24 -0
- data/lib/uttk/dumpers/Xml.rb +88 -0
- data/lib/uttk/dumpers/Yaml.rb +138 -0
- data/lib/uttk/filters.rb +128 -0
- data/lib/uttk/filters/Buffer.rb +119 -0
- data/lib/uttk/filters/Compact.rb +75 -0
- data/lib/uttk/filters/Default.rb +27 -0
- data/lib/uttk/filters/DefaultColor.rb +27 -0
- data/lib/uttk/filters/Filter.rb +53 -0
- data/lib/uttk/filters/Id.rb +30 -0
- data/lib/uttk/filters/JustStatus.rb +25 -0
- data/lib/uttk/filters/KeepSkipBased.rb +38 -0
- data/lib/uttk/filters/NodeCut.rb +97 -0
- data/lib/uttk/filters/RPathFilter.rb +134 -0
- data/lib/uttk/filters/Saver.rb +53 -0
- data/lib/uttk/filters/TextFilter.rb +69 -0
- data/lib/uttk/generators/dumper_generator.rb +28 -0
- data/lib/uttk/generators/filter_generator.rb +28 -0
- data/lib/uttk/generators/generator.rb +86 -0
- data/lib/uttk/generators/generator_generator.rb +26 -0
- data/lib/uttk/generators/loader_generator.rb +28 -0
- data/lib/uttk/generators/path_filter_generator.rb +28 -0
- data/lib/uttk/generators/strategy_generator.rb +28 -0
- data/lib/uttk/generators/templates/dumper.rb +50 -0
- data/lib/uttk/generators/templates/filter.rb +50 -0
- data/lib/uttk/generators/templates/generator.rb +28 -0
- data/lib/uttk/generators/templates/loader.rb +26 -0
- data/lib/uttk/generators/templates/path_filter.rb +28 -0
- data/lib/uttk/generators/templates/strategy.rb +59 -0
- data/lib/uttk/generators/templates/strategy.yml +28 -0
- data/lib/uttk/generators/templates/unit_test.rb +46 -0
- data/lib/uttk/loaders/Loader.rb +180 -0
- data/lib/uttk/loaders/Ruby.rb +28 -0
- data/lib/uttk/loaders/Yaml.rb +98 -0
- data/lib/uttk/logger.rb +306 -0
- data/lib/uttk/logger/backend.rb +170 -0
- data/lib/uttk/logger/path.rb +202 -0
- data/lib/uttk/logger/section_node.rb +214 -0
- data/lib/uttk/logger/severity.rb +63 -0
- data/lib/uttk/logger/to_uttk_log.rb +127 -0
- data/lib/uttk/logger/verbosity.rb +61 -0
- data/lib/uttk/logger_factory.rb +55 -0
- data/lib/uttk/path_filters/ColorStatus.rb +57 -0
- data/lib/uttk/path_filters/PathFilter.rb +27 -0
- data/lib/uttk/path_filters/RemoveTypes.rb +25 -0
- data/lib/uttk/status.rb +146 -0
- data/lib/uttk/strategies/Abort.rb +24 -0
- data/lib/uttk/strategies/Assert.rb +44 -0
- data/lib/uttk/strategies/Authors.rb +45 -0
- data/lib/uttk/strategies/Block.rb +113 -0
- data/lib/uttk/strategies/Bootstrap.rb +55 -0
- data/lib/uttk/strategies/Checkout.rb +64 -0
- data/lib/uttk/strategies/Clean.rb +29 -0
- data/lib/uttk/strategies/Cmd.rb +60 -0
- data/lib/uttk/strategies/CmdBase.rb +130 -0
- data/lib/uttk/strategies/Collection.rb +158 -0
- data/lib/uttk/strategies/Compile.rb +59 -0
- data/lib/uttk/strategies/Composite.rb +201 -0
- data/lib/uttk/strategies/Composite/contents_eval.rb +40 -0
- data/lib/uttk/strategies/Configure.rb +66 -0
- data/lib/uttk/strategies/Error.rb +23 -0
- data/lib/uttk/strategies/Fail.rb +26 -0
- data/lib/uttk/strategies/IOBased.rb +159 -0
- data/lib/uttk/strategies/Import.rb +60 -0
- data/lib/uttk/strategies/Iterate.rb +139 -0
- data/lib/uttk/strategies/JUnit.rb +205 -0
- data/lib/uttk/strategies/KillAll.rb +62 -0
- data/lib/uttk/strategies/Make.rb +94 -0
- data/lib/uttk/strategies/Package.rb +129 -0
- data/lib/uttk/strategies/PackageCollection.rb +78 -0
- data/lib/uttk/strategies/Pass.rb +24 -0
- data/lib/uttk/strategies/Pool.rb +104 -0
- data/lib/uttk/strategies/ProbabilityThreshold.rb +46 -0
- data/lib/uttk/strategies/Proxy.rb +42 -0
- data/lib/uttk/strategies/RMatch.rb +92 -0
- data/lib/uttk/strategies/RUnit.rb +132 -0
- data/lib/uttk/strategies/SignalCmd.rb +85 -0
- data/lib/uttk/strategies/Sleep.rb +36 -0
- data/lib/uttk/strategies/SqlQuery.rb +120 -0
- data/lib/uttk/strategies/Strategy.rb +683 -0
- data/lib/uttk/strategies/Stub.rb +37 -0
- data/lib/uttk/strategies/SubCmd.rb +77 -0
- data/lib/uttk/strategies/Suite.rb +71 -0
- data/lib/uttk/strategies/Test.rb +89 -0
- data/lib/uttk/streams.rb +69 -0
- data/lib/uttk/streams/Diff.rb +60 -0
- data/lib/uttk/streams/HexaDiff.rb +35 -0
- data/lib/uttk/streams/Stream.rb +76 -0
- data/lib/uttk/weights.rb +17 -0
- data/lib/uttk/weights/WExpr.rb +68 -0
- data/lib/uttk/weights/WFloat.rb +23 -0
- data/lib/uttk/weights/WMin.rb +22 -0
- data/lib/uttk/weights/Weight.rb +105 -0
- data/lib/www/javascripts/uttk.js +185 -0
- data/misc/expandtab.rb +29 -0
- data/misc/header.rb +44 -0
- data/misc/renaming +57 -0
- data/misc/textile_compiler +194 -0
- data/misc/uttk-grep.sh +8 -0
- data/misc/uttk-line-count.rb +143 -0
- data/test/examples-suite.yml +8 -0
- data/test/examples/README +68 -0
- data/test/examples/basic.rb +10 -0
- data/test/examples/basic.yml +9 -0
- data/test/examples/cache/cache_and_fatal.yml +5 -0
- data/test/examples/cache/simple.yml +30 -0
- data/test/examples/sql/basic.yml +24 -0
- data/test/examples/students-suite.yml +9 -0
- data/test/examples/students/ball.yml +11 -0
- data/test/examples/students/glob_stud.yml +20 -0
- data/test/examples/students/mini-lib.yml +61 -0
- data/test/examples/students/pool_stud.yml +31 -0
- data/test/examples/students/stud.yml +21 -0
- data/test/fixtures/ball/20040804-exam_a1-zapngo-tessar_m.tar.gz +0 -0
- data/test/fixtures/ball/Makefile +24 -0
- data/test/fixtures/ball/bar_p-mini-lib.tar.bz2 +0 -0
- data/test/fixtures/ball/bar_p-mini-lib/Makefile +20 -0
- data/test/fixtures/ball/bar_p-mini-lib/my_strlen.c +13 -0
- data/test/fixtures/ball/foo_s-mini-lib.tar.bz2 +0 -0
- data/test/fixtures/ball/foo_s-mini-lib/Makefile +20 -0
- data/test/fixtures/ball/foo_s-mini-lib/configure +2 -0
- data/test/fixtures/ball/foo_s-mini-lib/my_strlen.c +10 -0
- data/test/fixtures/ball/hello.tar.bz2 +0 -0
- data/test/fixtures/ball/hello.tar.gz +0 -0
- data/test/fixtures/ball/hello/Makefile +14 -0
- data/test/fixtures/ball/hello/hello.c +7 -0
- data/test/fixtures/ball/jack-exit.tar.bz2 +0 -0
- data/test/fixtures/ball/jack-exit/Makefile +14 -0
- data/test/fixtures/ball/jack-exit/exit.c +16 -0
- data/test/fixtures/ball/joe-exit.tar.bz2 +0 -0
- data/test/fixtures/ball/joe-exit/Makefile +14 -0
- data/test/fixtures/ball/joe-exit/exit.c +8 -0
- data/test/fixtures/ball/joe_i-mini-lib.tar.bz2 +0 -0
- data/test/fixtures/ball/joe_i-mini-lib/Makefile +20 -0
- data/test/fixtures/ball/joe_i-mini-lib/configure +2 -0
- data/test/fixtures/ball/joe_i-mini-lib/my_strlen.c +10 -0
- data/test/fixtures/ball/john-exit.tar.bz2 +0 -0
- data/test/fixtures/ball/john-exit/Makefile +14 -0
- data/test/fixtures/ball/john-exit/exit.c +6 -0
- data/test/fixtures/ball/qux_j-mini-lib.tar.bz2 +0 -0
- data/test/fixtures/ball/qux_j-mini-lib/Makefile +20 -0
- data/test/fixtures/ball/qux_j-mini-lib/my_strlen.c +12 -0
- data/test/fixtures/binaries/segv +0 -0
- data/test/fixtures/binaries/segv.c +10 -0
- data/test/fixtures/binaries/segv.rb +2 -0
- data/test/fixtures/demo/command-tutorial/steps/1/check.yml +5 -0
- data/test/fixtures/demo/command-tutorial/steps/1/pluralizer.rb +10 -0
- data/test/fixtures/demo/command-tutorial/steps/2/bad_check.yml +7 -0
- data/test/fixtures/demo/command-tutorial/steps/2/check.yml +7 -0
- data/test/fixtures/demo/command-tutorial/steps/2/pluralizer.rb +10 -0
- data/test/fixtures/demo/command-tutorial/steps/3.1/check.yml +12 -0
- data/test/fixtures/demo/command-tutorial/steps/3/check.yml +14 -0
- data/test/fixtures/demo/command-tutorial/steps/4.1/bird.txt +1 -0
- data/test/fixtures/demo/command-tutorial/steps/4.1/check.yml +12 -0
- data/test/fixtures/demo/command-tutorial/steps/4/check.yml +12 -0
- data/test/fixtures/demo/command-tutorial/steps/4/pluralizer.rb +12 -0
- data/test/fixtures/demo/command-tutorial/steps/5.1/bird.txt +1 -0
- data/test/fixtures/demo/command-tutorial/steps/5.1/check.yml +17 -0
- data/test/fixtures/demo/command-tutorial/steps/5.1/pluralizer.rb +17 -0
- data/test/fixtures/demo/command-tutorial/steps/5/bird.txt +1 -0
- data/test/fixtures/demo/command-tutorial/steps/5/check.yml +16 -0
- data/test/fixtures/demo/command-tutorial/steps/5/pluralizer.rb +16 -0
- data/test/fixtures/demo/command-tutorial/steps/6.1/bird.txt +1 -0
- data/test/fixtures/demo/command-tutorial/steps/6.1/check.yml +22 -0
- data/test/fixtures/demo/command-tutorial/steps/6.1/pluralizer.rb +17 -0
- data/test/fixtures/demo/command-tutorial/steps/6/bird.txt +1 -0
- data/test/fixtures/demo/command-tutorial/steps/6/check.yml +21 -0
- data/test/fixtures/demo/command-tutorial/steps/6/pluralizer.rb +17 -0
- data/test/fixtures/demo/command-tutorial/steps/7/bird.txt +1 -0
- data/test/fixtures/demo/command-tutorial/steps/7/check.yml +22 -0
- data/test/fixtures/demo/command-tutorial/steps/7/pluralizer.rb +17 -0
- data/test/fixtures/demo/filter-tutorial/check.yml +20 -0
- data/test/fixtures/demo/filter-tutorial/filters/CutSkip100.rb +19 -0
- data/test/fixtures/demo/filter-tutorial/pluralizer.rb +17 -0
- data/test/fixtures/java/unit/MultiRight/Foo/Foo.java +11 -0
- data/test/fixtures/java/unit/MultiRight/Foo/FooTest.java +15 -0
- data/test/fixtures/java/unit/MultiRight/MultiRight.java +13 -0
- data/test/fixtures/java/unit/MultiRight/MultiRightTest.java +12 -0
- data/test/fixtures/java/unit/MultiRight/bar/Bar.java +11 -0
- data/test/fixtures/java/unit/MultiRight/bar/BarTest.java +21 -0
- data/test/fixtures/java/unit/MultiRight/build.sh +7 -0
- data/test/fixtures/java/unit/SimpleException/SimpleExceptionTest.java +11 -0
- data/test/fixtures/java/unit/SimpleException/build.sh +4 -0
- data/test/fixtures/java/unit/build.sh +9 -0
- data/test/fixtures/java/unit/multibar.yml +6 -0
- data/test/fixtures/java/unit/multifoo.yml +6 -0
- data/test/fixtures/java/unit/multiright.yml +8 -0
- data/test/fixtures/java/unit/simple_exception.yml +6 -0
- data/test/fixtures/mini-lib/Makefile +9 -0
- data/test/fixtures/mini-lib/strlen.c +15 -0
- data/test/fixtures/package/pkg_foo.tar.gz +0 -0
- data/test/fixtures/package/pkg_foo/Makefile +20 -0
- data/test/fixtures/package/pkg_foo/bootstrap +3 -0
- data/test/fixtures/package/pkg_foo/configure +3 -0
- data/test/fixtures/package/pkg_foo/foo.sh +2 -0
- data/test/fixtures/text/1.txt +4 -0
- data/test/fixtures/unit/bad.rb +26 -0
- data/test/fixtures/unit/error.rb +6 -0
- data/test/fixtures/unit/good.rb +26 -0
- data/test/functional-suite.yml +10 -0
- data/test/functional/author.yml +11 -0
- data/test/functional/base.yml +119 -0
- data/test/functional/base_pool.yml +13 -0
- data/test/functional/block.yml +13 -0
- data/test/functional/cat.yml +16 -0
- data/test/functional/cmd.yml +17 -0
- data/test/functional/diff.yml +27 -0
- data/test/functional/env_cmd.yml +53 -0
- data/test/functional/exit.yml +15 -0
- data/test/functional/fatal.yml +23 -0
- data/test/functional/glob.yml +11 -0
- data/test/functional/hexa-diff.yml +25 -0
- data/test/functional/import.yml +41 -0
- data/test/functional/iterate.yml +99 -0
- data/test/functional/killall.yml +31 -0
- data/test/functional/pkg.yml +14 -0
- data/test/functional/probability_threshold.yml +35 -0
- data/test/functional/r_unit.yml +26 -0
- data/test/functional/rmatch.yml +122 -0
- data/test/functional/signal_cmd.yml +22 -0
- data/test/functional/sub.yml +15 -0
- data/test/functional/test.yml +25 -0
- data/test/functional/timeout.yml +20 -0
- data/test/functional/wc.yml +26 -0
- data/test/functional/weight.yml +152 -0
- data/test/pkg-suite.yml +8 -0
- data/test/pkg/cmdline.yml +80 -0
- data/test/pool-suite.yml +8 -0
- data/test/pool/base.yml +12 -0
- data/test/pool/pool.yml +25 -0
- data/test/ruby-suite.rb +10 -0
- data/test/ruby-suite.yml +5 -0
- data/test/ruby/base.rb +119 -0
- data/test/ruby/iterate.rb +21 -0
- data/test/ruby/wc.rb +43 -0
- data/test/unit-suite.yml +10 -0
- data/test/unit/dumpers/path_test.rb +46 -0
- data/test/unit/dumpers/xml_test.rb +65 -0
- data/test/unit/dumpers/yaml_test.rb +65 -0
- data/test/unit/filters/buffer_test.rb +168 -0
- data/test/unit/filters/keep_skip_based_test.rb +46 -0
- data/test/unit/filters/node_cut_test.rb +72 -0
- data/test/unit/filters/rpath_filter_test.rb +191 -0
- data/test/unit/filters/text_filter_test.rb +46 -0
- data/test/unit/filters_test.rb +119 -0
- data/test/unit/logger/section_node_test.rb +120 -0
- data/test/unit/logger/severity_test.rb +37 -0
- data/test/unit/logger/to_uttk_log_test.rb +113 -0
- data/test/unit/logger/verbosity_test.rb +44 -0
- data/test/unit/logger_test.rb +203 -0
- data/test/unit/strategies/suite_test.rb +151 -0
- data/test/uttk-check.yml +8 -0
- data/test/uttk-distcheck.yml +18 -0
- metadata +399 -0
@@ -0,0 +1,72 @@
|
|
1
|
+
# Author:: Nicolas Pouillard <ertai@lrde.epita.fr>.
|
2
|
+
# Copyright:: Copyright (c) 2005 Uttk Team. All rights reserved.
|
3
|
+
# License:: LGPL
|
4
|
+
# Revision:: $Id: /w/fey/uttk/trunk/test/unit/filters/node_cut_test.rb 21844 2006-02-17T17:26:59.771162Z pouillar $
|
5
|
+
|
6
|
+
test_section __FILE__ do
|
7
|
+
|
8
|
+
module Uttk
|
9
|
+
|
10
|
+
module Filters
|
11
|
+
|
12
|
+
class NodeCutTest < ::Test::Unit::TestCase
|
13
|
+
include Mocks::Assertions
|
14
|
+
include NodeCut::Assertions
|
15
|
+
|
16
|
+
@@output_string = "
|
17
|
+
|root:
|
18
|
+
| contents:
|
19
|
+
| - Test1:
|
20
|
+
| status: PASS
|
21
|
+
| - Test2:
|
22
|
+
| status: FAIL
|
23
|
+
| status: FAIL(50%)
|
24
|
+
".head_cut!
|
25
|
+
|
26
|
+
@@output_tree = YAML.load(@@output_string)
|
27
|
+
|
28
|
+
@@original =
|
29
|
+
[[[:root, [:contents, {:ordered=>true}], :Test1, :status], "PASS"],
|
30
|
+
[[:root, [:contents, {:ordered=>true}], :Test2, :status], "FAIL"],
|
31
|
+
[[:root, :status], "FAIL(50%)"]]
|
32
|
+
|
33
|
+
@@without_contents =
|
34
|
+
[[[:root, :Test1, :status], "PASS"],
|
35
|
+
[[:root, :Test2, :status], "FAIL"],
|
36
|
+
[[:root, :status], "FAIL(50%)"]]
|
37
|
+
|
38
|
+
@@without_test1_prune =
|
39
|
+
[[[:root, [:contents, {:ordered=>true}], :Test2, :status], "FAIL"],
|
40
|
+
[[:root, :status], "FAIL(50%)"]]
|
41
|
+
|
42
|
+
#
|
43
|
+
# Methods
|
44
|
+
#
|
45
|
+
|
46
|
+
def setup
|
47
|
+
super
|
48
|
+
@mock_object = Mocks::Observer.new
|
49
|
+
end
|
50
|
+
|
51
|
+
def teardown
|
52
|
+
end
|
53
|
+
|
54
|
+
#
|
55
|
+
# Tests
|
56
|
+
#
|
57
|
+
|
58
|
+
def test_without_contents
|
59
|
+
assert_node_cut @@original, @@without_contents, :skip => %r{contents}
|
60
|
+
end
|
61
|
+
|
62
|
+
def test_without_test1_prune
|
63
|
+
assert_node_cut @@original, @@without_test1_prune, :skip => %r{Test1}, :prune => true
|
64
|
+
end
|
65
|
+
|
66
|
+
end # class NodeCutTest
|
67
|
+
|
68
|
+
end # module Filters
|
69
|
+
|
70
|
+
end # module Uttk
|
71
|
+
|
72
|
+
end
|
@@ -0,0 +1,191 @@
|
|
1
|
+
# Author:: Nicolas Pouillard <ertai@lrde.epita.fr>.
|
2
|
+
# Copyright:: Copyright (c) 2005 Uttk Team. All rights reserved.
|
3
|
+
# License:: LGPL
|
4
|
+
# Revision:: $Id: /w/fey/uttk/trunk/test/unit/filters/rpath_filter_test.rb 22089 2006-02-21T16:03:00.498332Z pouillar $
|
5
|
+
|
6
|
+
|
7
|
+
test_section __FILE__ do
|
8
|
+
|
9
|
+
module Uttk
|
10
|
+
|
11
|
+
module Filters
|
12
|
+
|
13
|
+
class RPathFilterTest < ::Test::Unit::TestCase
|
14
|
+
include Mocks::Assertions
|
15
|
+
include RPathFilter::Assertions
|
16
|
+
|
17
|
+
#
|
18
|
+
# Data
|
19
|
+
#
|
20
|
+
|
21
|
+
@@output_string = "
|
22
|
+
|root:
|
23
|
+
| strategy: Suite
|
24
|
+
| contents:
|
25
|
+
| - noname:
|
26
|
+
| strategy: Suite
|
27
|
+
| contents:
|
28
|
+
| - Test login=joe:
|
29
|
+
| strategy: Pass
|
30
|
+
| status: PASS
|
31
|
+
| - Test login=bar:
|
32
|
+
| strategy: Pass
|
33
|
+
| status: PASS
|
34
|
+
| - Test login=foo:
|
35
|
+
| strategy: Fail
|
36
|
+
| status: FAIL
|
37
|
+
| reason: Fail always fails
|
38
|
+
| - Test login=yo:
|
39
|
+
| strategy: Abort
|
40
|
+
| status: ABORT
|
41
|
+
| reason: Abort strategy always aborts
|
42
|
+
| - Test login=yeah:
|
43
|
+
| strategy: Fail
|
44
|
+
| status: FAIL
|
45
|
+
| reason: Fail always fails
|
46
|
+
| status: FAIL(40%)
|
47
|
+
| status: FAIL(40%)
|
48
|
+
".head_cut!
|
49
|
+
|
50
|
+
@@output_tree = YAML.load(@@output_string)
|
51
|
+
|
52
|
+
#
|
53
|
+
# Methods
|
54
|
+
#
|
55
|
+
|
56
|
+
def setup
|
57
|
+
super
|
58
|
+
self.logger = Logger.new
|
59
|
+
self.output_tree = @@output_tree
|
60
|
+
self.mock_object = Mocks::Observer.new
|
61
|
+
end
|
62
|
+
|
63
|
+
def teardown
|
64
|
+
super
|
65
|
+
# ...
|
66
|
+
end
|
67
|
+
|
68
|
+
class TestFilter1 < RPathFilter
|
69
|
+
# display login and status
|
70
|
+
# no bufferization needed
|
71
|
+
match '/root/contents/noname/contents/login=(.*)/status/(.*)', :run
|
72
|
+
|
73
|
+
def run ( tree, login, status )
|
74
|
+
# here the status and the tree are equal
|
75
|
+
@log[login] = status
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
79
|
+
class TestFilter2 < RPathFilter
|
80
|
+
match '/root/contents/noname/contents/login=(.*)/status/(.*)' do
|
81
|
+
|obj, tree, login, status|
|
82
|
+
obj.log[login] = status
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
86
|
+
class TestFilter3 < RPathFilter
|
87
|
+
# display login and status
|
88
|
+
# with a buffer (see the star before login)
|
89
|
+
match '/root/contents/noname/contents/login=(.*)/*status$', :yeah
|
90
|
+
|
91
|
+
def yeah ( tree, login )
|
92
|
+
@log[login] = tree.rpath_find :first, '/status/'
|
93
|
+
end
|
94
|
+
end
|
95
|
+
|
96
|
+
class TestFilter4 < RPathFilter
|
97
|
+
# with a buffer (see the star before status)
|
98
|
+
match '//cont//ents/lo.in=(.*)/()st.tus/FAIL' do |obj, tree, login|
|
99
|
+
obj.log[login] = tree.rpath_find :first, '/reason/'
|
100
|
+
end
|
101
|
+
end
|
102
|
+
|
103
|
+
# With two matchers
|
104
|
+
# FIXME try to use only one buffer
|
105
|
+
class TestFilter5 < RPathFilter
|
106
|
+
match '//contents//contents/login=(.*)/()status/PASS', :pass
|
107
|
+
match '//contents//contents/login=(.*)/()status/FAIL', :fail
|
108
|
+
def fail ( tree, login )
|
109
|
+
@log[login] = "FAIL, " + tree.rpath_find(:first, '/reason/.*')
|
110
|
+
end
|
111
|
+
def pass ( tree, login )
|
112
|
+
@log[login] = "PASS strategy: " +
|
113
|
+
tree.rpath_find(:first, '/strategy/.*')
|
114
|
+
end
|
115
|
+
end
|
116
|
+
|
117
|
+
class TestFilter6 < RPathFilter
|
118
|
+
# display the name of a test and it's status
|
119
|
+
match '(.*)/^status$/(.*)\Z', :yeah
|
120
|
+
|
121
|
+
def yeah ( tree, name, status )
|
122
|
+
@log[name] = status
|
123
|
+
end
|
124
|
+
end
|
125
|
+
|
126
|
+
|
127
|
+
#
|
128
|
+
# Tests
|
129
|
+
#
|
130
|
+
|
131
|
+
@@notifs1 = [
|
132
|
+
[[:joe], "PASS"],
|
133
|
+
[[:bar], "PASS"],
|
134
|
+
[[:foo], "FAIL"],
|
135
|
+
[[:yo], "ABORT"],
|
136
|
+
[[:yeah], "FAIL"]
|
137
|
+
]
|
138
|
+
|
139
|
+
@@notifs2 = [
|
140
|
+
[[:foo], "Fail always fails"],
|
141
|
+
[[:yeah], "Fail always fails"]
|
142
|
+
]
|
143
|
+
|
144
|
+
@@notifs3 = [
|
145
|
+
[[:joe], "PASS strategy: Pass"],
|
146
|
+
[[:bar], "PASS strategy: Pass"],
|
147
|
+
[[:foo], "FAIL, Fail always fails"],
|
148
|
+
[[:yeah], "FAIL, Fail always fails"]
|
149
|
+
]
|
150
|
+
|
151
|
+
@@notifs4 = [
|
152
|
+
[[:root], "FAIL(40%)"],
|
153
|
+
[[:noname], "FAIL(40%)"],
|
154
|
+
[[:"Test login=joe"], "PASS"],
|
155
|
+
[[:"Test login=bar"], "PASS"],
|
156
|
+
[[:"Test login=foo"], "FAIL"],
|
157
|
+
[[:"Test login=yo"], "ABORT"],
|
158
|
+
[[:"Test login=yeah"], "FAIL"]
|
159
|
+
]
|
160
|
+
|
161
|
+
def test_filter1
|
162
|
+
assert_rpath_filter(@@notifs1, TestFilter1)
|
163
|
+
end
|
164
|
+
|
165
|
+
def test_filter2
|
166
|
+
assert_rpath_filter(@@notifs1, TestFilter2)
|
167
|
+
end
|
168
|
+
|
169
|
+
def test_filter3
|
170
|
+
assert_rpath_filter(@@notifs1, TestFilter3)
|
171
|
+
end
|
172
|
+
|
173
|
+
def test_filter4
|
174
|
+
assert_rpath_filter(@@notifs2, TestFilter4)
|
175
|
+
end
|
176
|
+
|
177
|
+
def test_filter5
|
178
|
+
assert_rpath_filter(@@notifs3, TestFilter5)
|
179
|
+
end
|
180
|
+
|
181
|
+
def test_filter6
|
182
|
+
assert_rpath_filter(@@notifs4, TestFilter6)
|
183
|
+
end
|
184
|
+
|
185
|
+
end # class RPathFilterTest
|
186
|
+
|
187
|
+
end # module Filters
|
188
|
+
|
189
|
+
end # module Uttk
|
190
|
+
|
191
|
+
end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
# Author:: Nicolas Pouillard <ertai@lrde.epita.fr>.
|
2
|
+
# Copyright:: Copyright (c) 2005 Uttk Team. All rights reserved.
|
3
|
+
# License:: LGPL
|
4
|
+
# Revision:: $Id: /fey/uttk/trunk/test/unit/filters/text_filter_test.rb 8778 2005-09-26T04:34:48.103938Z ertai $
|
5
|
+
|
6
|
+
test_section __FILE__ do
|
7
|
+
|
8
|
+
module Uttk
|
9
|
+
|
10
|
+
module Filters
|
11
|
+
|
12
|
+
class TextFilterTest < ::Test::Unit::TestCase
|
13
|
+
|
14
|
+
#
|
15
|
+
# Methods
|
16
|
+
#
|
17
|
+
|
18
|
+
def setup
|
19
|
+
super
|
20
|
+
# ...
|
21
|
+
end
|
22
|
+
|
23
|
+
def teardown
|
24
|
+
super
|
25
|
+
# ...
|
26
|
+
end
|
27
|
+
|
28
|
+
#
|
29
|
+
# Tests
|
30
|
+
#
|
31
|
+
|
32
|
+
def test_xxx
|
33
|
+
# ...
|
34
|
+
end
|
35
|
+
|
36
|
+
def test_yyy
|
37
|
+
# ...
|
38
|
+
end
|
39
|
+
|
40
|
+
end # class TextFilterTest
|
41
|
+
|
42
|
+
end # module Filters
|
43
|
+
|
44
|
+
end # module Uttk
|
45
|
+
|
46
|
+
end
|
@@ -0,0 +1,119 @@
|
|
1
|
+
# Author:: Nicolas Despr�s <nicolas.despres@lrde.epita.fr>.
|
2
|
+
# Copyright:: Copyright (c) 2005 Uttk Team. All rights reserved.
|
3
|
+
# License:: LGPL
|
4
|
+
# $Id: /w/fey/uttk/trunk/test/unit/filters_test.rb 22057 2006-02-20T21:40:27.185401Z pouillar $
|
5
|
+
|
6
|
+
|
7
|
+
test_section __FILE__ do
|
8
|
+
|
9
|
+
module Uttk
|
10
|
+
|
11
|
+
# Test the method provided by the Filters module.
|
12
|
+
class FiltersTest < Test::Unit::TestCase
|
13
|
+
|
14
|
+
def test_backend
|
15
|
+
# test Yaml
|
16
|
+
backend = Uttk::Filters['Yaml']
|
17
|
+
assert_equal 1, backend.size
|
18
|
+
assert_dumper backend.first, Uttk::Dumpers::Yaml, STDOUT
|
19
|
+
# test Yaml: foo
|
20
|
+
TempPath.new('filters_test') do |tmp|
|
21
|
+
io = tmp.open('w')
|
22
|
+
backend = Uttk::Filters["Yaml: #{tmp}"]
|
23
|
+
assert_equal 1, backend.size
|
24
|
+
assert_dumper backend.first, Uttk::Dumpers::Yaml, io
|
25
|
+
end
|
26
|
+
# test Xml: foo, Yaml: bar
|
27
|
+
TempPath.new('filters_test') do |tmp1|
|
28
|
+
io1 = tmp1.open('w')
|
29
|
+
TempPath.new('filters_test') do |tmp2|
|
30
|
+
io2 = tmp2.open('w')
|
31
|
+
backend = Uttk::Filters["Xml: #{tmp1}, Yaml: #{tmp2}"]
|
32
|
+
assert_dumpers(backend, 2,
|
33
|
+
[ Uttk::Dumpers::Xml, io1 ],
|
34
|
+
[ Uttk::Dumpers::Yaml, io2 ])
|
35
|
+
end
|
36
|
+
end
|
37
|
+
# test [{Xml: foo}, {Xml: bar}]
|
38
|
+
TempPath.new('filters_test') do |tmp1|
|
39
|
+
io1 = tmp1.open('w')
|
40
|
+
TempPath.new('filters_test') do |tmp2|
|
41
|
+
io2 = tmp2.open('w')
|
42
|
+
backend = Uttk::Filters[" [{Xml: #{tmp1}}, {Xml: #{tmp2}}]"]
|
43
|
+
assert_equal 2, backend.size
|
44
|
+
assert_dumper backend.first, Uttk::Dumpers::Xml, io1
|
45
|
+
assert_dumper backend.last, Uttk::Dumpers::Xml, io2
|
46
|
+
end
|
47
|
+
end
|
48
|
+
# test Xml: [ foo, bar]
|
49
|
+
TempPath.new('filters_test') do |tmp1|
|
50
|
+
io1 = tmp1.open('w')
|
51
|
+
TempPath.new('filters_test') do |tmp2|
|
52
|
+
io2 = tmp2.open('w')
|
53
|
+
backend = Uttk::Filters["Xml: [#{tmp1}, #{tmp2}]"]
|
54
|
+
assert_equal 1, backend.size
|
55
|
+
assert_dumper backend.first, Uttk::Dumpers::Xml, io1, io2
|
56
|
+
end
|
57
|
+
end
|
58
|
+
# test Basic, Xml: log.xml
|
59
|
+
TempPath.new('filters_test') do |tmp|
|
60
|
+
io = tmp.open('w')
|
61
|
+
backend = Uttk::Filters["Basic, Xml: #{tmp}"]
|
62
|
+
assert_dumpers(backend, 2,
|
63
|
+
[ Uttk::Dumpers::Basic, STDOUT ],
|
64
|
+
[ Uttk::Dumpers::Xml, io ])
|
65
|
+
end
|
66
|
+
# test JustStatus: Basic
|
67
|
+
backend = Uttk::Filters["JustStatus: Basic"]
|
68
|
+
assert_equal 1, backend.size
|
69
|
+
observers = assert_filter backend.first, Uttk::Filters::JustStatus, 1
|
70
|
+
assert_dumper observers.first, Uttk::Dumpers::Basic, STDOUT
|
71
|
+
# test JustStatus: {Basic, Xml: log.xml}
|
72
|
+
TempPath.new('filters_test') do |tmp|
|
73
|
+
io = tmp.open('w')
|
74
|
+
backend = Uttk::Filters["JustStatus: {Basic, Xml: #{tmp}}"]
|
75
|
+
assert_equal 1, backend.size
|
76
|
+
observers = assert_filter backend.first, Uttk::Filters::JustStatus, 2
|
77
|
+
assert_dumpers(observers, 2,
|
78
|
+
[ Uttk::Dumpers::Yaml, STDOUT ],
|
79
|
+
[ Uttk::Dumpers::Xml, io ])
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
83
|
+
protected
|
84
|
+
|
85
|
+
def assert_dumper(dumper, dumper_class, *outputs)
|
86
|
+
assert_kind_of dumper_class, dumper
|
87
|
+
dumper.each_output do |output|
|
88
|
+
assert_equal output.inspect, outputs.shift.inspect
|
89
|
+
end
|
90
|
+
end
|
91
|
+
|
92
|
+
def assert_dumpers(dumpers, nb_dumpers, *descs)
|
93
|
+
assert_equal nb_dumpers, dumpers.size
|
94
|
+
dumpers.each { |dumper| check_dumper_desc(dumper, descs) }
|
95
|
+
end
|
96
|
+
|
97
|
+
def check_dumper_desc(dumper, descs)
|
98
|
+
descs.each do |desc|
|
99
|
+
if desc.first == dumper.class
|
100
|
+
assert_dumper(dumper, *desc)
|
101
|
+
return true
|
102
|
+
end
|
103
|
+
end
|
104
|
+
return false
|
105
|
+
end
|
106
|
+
|
107
|
+
def assert_filter(filter, filter_class, nb_observers)
|
108
|
+
assert_kind_of filter_class, filter
|
109
|
+
observers = []
|
110
|
+
filter.instance_eval { observers = @observer_peers }
|
111
|
+
assert_equal nb_observers, observers.size
|
112
|
+
observers
|
113
|
+
end
|
114
|
+
|
115
|
+
end # class Filters
|
116
|
+
|
117
|
+
end # module Uttk
|
118
|
+
|
119
|
+
end # test_section __FILE__
|
@@ -0,0 +1,120 @@
|
|
1
|
+
# Author:: Nicolas Despr�s <nicolas.despres@lrde.epita.fr>.
|
2
|
+
# Copyright:: Copyright (c) 2005 Uttk Team. All rights reserved.
|
3
|
+
# License:: LGPL
|
4
|
+
# $Id: /w/fey/uttk/trunk/test/unit/logger/section_node_test.rb 21975 2006-02-19T22:24:11.182512Z pouillar $
|
5
|
+
|
6
|
+
|
7
|
+
test_section __FILE__ do
|
8
|
+
|
9
|
+
|
10
|
+
module Uttk
|
11
|
+
|
12
|
+
class Logger
|
13
|
+
|
14
|
+
class SectionNodeTest < ::Test::Unit::TestCase
|
15
|
+
|
16
|
+
def setup
|
17
|
+
foo = SectionNode.new('foo',
|
18
|
+
SectionNode.new('baz',
|
19
|
+
SectionNode.new('son1'),
|
20
|
+
SectionNode.new('son2')),
|
21
|
+
SectionNode.new('goo'))
|
22
|
+
@tree = SectionNode.new('root',
|
23
|
+
foo,
|
24
|
+
SectionNode.new('bar'))
|
25
|
+
end
|
26
|
+
|
27
|
+
def test_name=
|
28
|
+
s = SectionNode.new('toto')
|
29
|
+
assert_equal('toto', s.name)
|
30
|
+
s.name = 'foo'
|
31
|
+
assert_equal('foo', s.name)
|
32
|
+
end
|
33
|
+
|
34
|
+
def test_sub_sections
|
35
|
+
assert_equal([], SectionNode.new('foo').sub_sections)
|
36
|
+
end
|
37
|
+
|
38
|
+
def test_label
|
39
|
+
s = SectionNode.new('foo',
|
40
|
+
SectionNode.new('bar'),
|
41
|
+
SectionNode.new('baz', SectionNode.new('goo')))
|
42
|
+
assert_equal('bar', s['bar'].name)
|
43
|
+
assert_equal('baz', s['baz'].name)
|
44
|
+
assert_equal('goo', s['baz']['goo'].name)
|
45
|
+
end
|
46
|
+
|
47
|
+
def test_find
|
48
|
+
goo = SectionNode.new('goo')
|
49
|
+
s = SectionNode.new('foo',
|
50
|
+
SectionNode.new('bar'),
|
51
|
+
SectionNode.new('baz', goo))
|
52
|
+
assert_equal(goo, s.find('goo'))
|
53
|
+
assert_nil(s.find('toto'))
|
54
|
+
end
|
55
|
+
|
56
|
+
def test_active_tree
|
57
|
+
s = SectionNode.new('foo',
|
58
|
+
SectionNode.new('bar'),
|
59
|
+
SectionNode.new('baz', SectionNode.new('goo')))
|
60
|
+
assert(! s.active?)
|
61
|
+
s.each_section { |ss| assert(! ss.active?) }
|
62
|
+
assert(! s['baz']['goo'].active?)
|
63
|
+
section_actived = s.active_tree(true)
|
64
|
+
expected_section = %w(foo bar baz goo)
|
65
|
+
expected_section.each do |x|
|
66
|
+
assert(section_actived.include?(x), "#{x} not actived")
|
67
|
+
end
|
68
|
+
assert_equal(expected_section.size, section_actived.size)
|
69
|
+
s.each_section { |ss| assert(ss.active?) }
|
70
|
+
assert(s['baz']['goo'].active?)
|
71
|
+
end
|
72
|
+
|
73
|
+
def test_active_section
|
74
|
+
assert_equal([], SectionNode.new('root').active_section('toto'))
|
75
|
+
assert_equal(['root'], SectionNode.new('root').active_section('root'))
|
76
|
+
assert_equal([], @tree.active_section('toto'))
|
77
|
+
section_actived = @tree.active_section('baz')
|
78
|
+
expected_section = %w(root foo baz son1 son2)
|
79
|
+
expected_section.each do |x|
|
80
|
+
assert(section_actived.include?(x), "#{x} not actived")
|
81
|
+
end
|
82
|
+
assert_equal(expected_section.size, section_actived.size)
|
83
|
+
end
|
84
|
+
|
85
|
+
def test_unactive_section__easy
|
86
|
+
assert_equal([], SectionNode.new('root').unactive_section('toto'))
|
87
|
+
assert_equal([], SectionNode.new('root').unactive_section('root'))
|
88
|
+
section_actived = @tree.active_section('baz')
|
89
|
+
section_actived = @tree.unactive_section('baz')
|
90
|
+
expected_section = %w(root foo baz son1 son2)
|
91
|
+
expected_section.each do |x|
|
92
|
+
assert(section_actived.include?(x), "#{x} not actived")
|
93
|
+
end
|
94
|
+
assert_equal(expected_section.size, section_actived.size)
|
95
|
+
end
|
96
|
+
|
97
|
+
def test_unactive_section__difficult
|
98
|
+
section_actived = @tree.active_section('baz')
|
99
|
+
section_actived = @tree.active_section('goo')
|
100
|
+
section_actived = @tree.unactive_section('baz')
|
101
|
+
expected_section = %w(baz son1 son2)
|
102
|
+
expected_section.each do |x|
|
103
|
+
assert(section_actived.include?(x), "#{x} not actived")
|
104
|
+
end
|
105
|
+
assert_equal(expected_section.size, section_actived.size)
|
106
|
+
section_actived = @tree.unactive_section('goo')
|
107
|
+
expected_section = %w(goo foo root)
|
108
|
+
expected_section.each do |x|
|
109
|
+
assert(section_actived.include?(x), "#{x} not actived")
|
110
|
+
end
|
111
|
+
assert_equal(expected_section.size, section_actived.size)
|
112
|
+
end
|
113
|
+
|
114
|
+
end # class SectionNodeTest
|
115
|
+
|
116
|
+
end # class Logger
|
117
|
+
|
118
|
+
end # module Uttk
|
119
|
+
|
120
|
+
end
|