test_bench-bootstrap 6.1.1 → 7.0.0

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.
Files changed (171) hide show
  1. checksums.yaml +4 -4
  2. data/executables/bench-bootstrap +7 -0
  3. data/lib/test_bench_bootstrap/controls.rb +1 -0
  4. data/lib/test_bench_bootstrap/test_bench_bootstrap.rb +7 -0
  5. data/lib/test_bench_bootstrap.rb +4 -0
  6. data/upstream-lib/test_bench_bootstrap/import_constants/controls/namespace.rb +84 -0
  7. data/upstream-lib/test_bench_bootstrap/import_constants/controls.rb +1 -0
  8. data/upstream-lib/test_bench_bootstrap/import_constants/import_constants.rb +46 -0
  9. data/upstream-lib/test_bench_bootstrap/import_constants/macro.rb +10 -0
  10. data/upstream-lib/test_bench_bootstrap/import_constants.rb +2 -0
  11. data/upstream-lib/test_bench_bootstrap/test_bench/controls/telemetry_sink.rb +7 -0
  12. data/upstream-lib/test_bench_bootstrap/test_bench/controls.rb +3 -0
  13. data/upstream-lib/test_bench_bootstrap/test_bench/executable/controls/path.rb +9 -0
  14. data/upstream-lib/test_bench_bootstrap/test_bench/executable/controls/random.rb +9 -0
  15. data/upstream-lib/test_bench_bootstrap/test_bench/executable/controls/run.rb +12 -0
  16. data/upstream-lib/test_bench_bootstrap/test_bench/executable/controls/standard_input.rb +31 -0
  17. data/upstream-lib/test_bench_bootstrap/test_bench/executable/controls.rb +8 -0
  18. data/upstream-lib/test_bench_bootstrap/test_bench/executable/defaults.rb +15 -0
  19. data/upstream-lib/test_bench_bootstrap/test_bench/executable/executable.rb +61 -0
  20. data/upstream-lib/test_bench_bootstrap/test_bench/executable/parse_arguments.rb +271 -0
  21. data/upstream-lib/test_bench_bootstrap/test_bench/executable.rb +7 -0
  22. data/upstream-lib/test_bench_bootstrap/test_bench/fixture/build.rb +41 -0
  23. data/upstream-lib/test_bench_bootstrap/test_bench/fixture/controls/comment_style.rb +9 -0
  24. data/upstream-lib/test_bench_bootstrap/test_bench/fixture/controls/exception.rb +9 -0
  25. data/upstream-lib/test_bench_bootstrap/test_bench/fixture/controls/fixture.rb +69 -0
  26. data/upstream-lib/test_bench_bootstrap/test_bench/fixture/controls/message.rb +9 -0
  27. data/upstream-lib/test_bench_bootstrap/test_bench/fixture/controls/output.rb +11 -0
  28. data/upstream-lib/test_bench_bootstrap/test_bench/fixture/controls/path.rb +9 -0
  29. data/upstream-lib/test_bench_bootstrap/test_bench/fixture/controls/session.rb +21 -0
  30. data/upstream-lib/test_bench_bootstrap/test_bench/fixture/controls/status.rb +9 -0
  31. data/upstream-lib/test_bench_bootstrap/test_bench/fixture/controls/text.rb +9 -0
  32. data/upstream-lib/test_bench_bootstrap/test_bench/fixture/controls/title.rb +9 -0
  33. data/upstream-lib/test_bench_bootstrap/test_bench/fixture/controls.rb +14 -0
  34. data/upstream-lib/test_bench_bootstrap/test_bench/fixture/evaluate.rb +37 -0
  35. data/upstream-lib/test_bench_bootstrap/test_bench/fixture/fixture.rb +213 -0
  36. data/upstream-lib/test_bench_bootstrap/test_bench/fixture.rb +7 -0
  37. data/upstream-lib/test_bench_bootstrap/test_bench/output/comment_style.rb +63 -0
  38. data/upstream-lib/test_bench_bootstrap/test_bench/output/controls/comment_style.rb +23 -0
  39. data/upstream-lib/test_bench_bootstrap/test_bench/output/controls/event.rb +9 -0
  40. data/upstream-lib/test_bench_bootstrap/test_bench/output/controls/events/aborted.rb +11 -0
  41. data/upstream-lib/test_bench_bootstrap/test_bench/output/controls/events/commented.rb +23 -0
  42. data/upstream-lib/test_bench_bootstrap/test_bench/output/controls/events/context_finished.rb +11 -0
  43. data/upstream-lib/test_bench_bootstrap/test_bench/output/controls/events/context_started.rb +11 -0
  44. data/upstream-lib/test_bench_bootstrap/test_bench/output/controls/events/detailed.rb +23 -0
  45. data/upstream-lib/test_bench_bootstrap/test_bench/output/controls/events/failed.rb +11 -0
  46. data/upstream-lib/test_bench_bootstrap/test_bench/output/controls/events/file_executed.rb +11 -0
  47. data/upstream-lib/test_bench_bootstrap/test_bench/output/controls/events/file_not_found.rb +11 -0
  48. data/upstream-lib/test_bench_bootstrap/test_bench/output/controls/events/file_queued.rb +11 -0
  49. data/upstream-lib/test_bench_bootstrap/test_bench/output/controls/events/skipped.rb +11 -0
  50. data/upstream-lib/test_bench_bootstrap/test_bench/output/controls/events/test_finished.rb +11 -0
  51. data/upstream-lib/test_bench_bootstrap/test_bench/output/controls/events/test_started.rb +11 -0
  52. data/upstream-lib/test_bench_bootstrap/test_bench/output/controls/random.rb +9 -0
  53. data/upstream-lib/test_bench_bootstrap/test_bench/output/controls/session.rb +19 -0
  54. data/upstream-lib/test_bench_bootstrap/test_bench/output/controls/status.rb +9 -0
  55. data/upstream-lib/test_bench_bootstrap/test_bench/output/controls/style.rb +41 -0
  56. data/upstream-lib/test_bench_bootstrap/test_bench/output/controls/text.rb +31 -0
  57. data/upstream-lib/test_bench_bootstrap/test_bench/output/controls.rb +26 -0
  58. data/upstream-lib/test_bench_bootstrap/test_bench/output/detail_policy.rb +46 -0
  59. data/upstream-lib/test_bench_bootstrap/test_bench/output/device/null.rb +21 -0
  60. data/upstream-lib/test_bench_bootstrap/test_bench/output/device/substitute.rb +46 -0
  61. data/upstream-lib/test_bench_bootstrap/test_bench/output/device.rb +75 -0
  62. data/upstream-lib/test_bench_bootstrap/test_bench/output/get.rb +32 -0
  63. data/upstream-lib/test_bench_bootstrap/test_bench/output/level.rb +53 -0
  64. data/upstream-lib/test_bench_bootstrap/test_bench/output/output.rb +572 -0
  65. data/upstream-lib/test_bench_bootstrap/test_bench/output/writer/style.rb +54 -0
  66. data/upstream-lib/test_bench_bootstrap/test_bench/output/writer/substitute.rb +27 -0
  67. data/upstream-lib/test_bench_bootstrap/test_bench/output/writer.rb +119 -0
  68. data/upstream-lib/test_bench_bootstrap/test_bench/output.rb +20 -0
  69. data/upstream-lib/test_bench_bootstrap/test_bench/random/controls/seed.rb +25 -0
  70. data/upstream-lib/test_bench_bootstrap/test_bench/random/controls/sequence.rb +70 -0
  71. data/upstream-lib/test_bench_bootstrap/test_bench/random/controls.rb +2 -0
  72. data/upstream-lib/test_bench_bootstrap/test_bench/random/defaults.rb +13 -0
  73. data/upstream-lib/test_bench_bootstrap/test_bench/random/generator/substitute.rb +23 -0
  74. data/upstream-lib/test_bench_bootstrap/test_bench/random/generator.rb +64 -0
  75. data/upstream-lib/test_bench_bootstrap/test_bench/random/iterator.rb +54 -0
  76. data/upstream-lib/test_bench_bootstrap/test_bench/random/random.rb +27 -0
  77. data/upstream-lib/test_bench_bootstrap/test_bench/random.rb +8 -0
  78. data/upstream-lib/test_bench_bootstrap/test_bench/run/controls/events.rb +9 -0
  79. data/upstream-lib/test_bench_bootstrap/test_bench/run/controls/message.rb +9 -0
  80. data/upstream-lib/test_bench_bootstrap/test_bench/run/controls/path.rb +9 -0
  81. data/upstream-lib/test_bench_bootstrap/test_bench/run/controls/random.rb +9 -0
  82. data/upstream-lib/test_bench_bootstrap/test_bench/run/controls/session.rb +16 -0
  83. data/upstream-lib/test_bench_bootstrap/test_bench/run/controls/status.rb +44 -0
  84. data/upstream-lib/test_bench_bootstrap/test_bench/run/controls/summary/file/info.rb +108 -0
  85. data/upstream-lib/test_bench_bootstrap/test_bench/run/controls/summary/file/totals.rb +38 -0
  86. data/upstream-lib/test_bench_bootstrap/test_bench/run/controls/summary/file.rb +44 -0
  87. data/upstream-lib/test_bench_bootstrap/test_bench/run/controls/summary/run.rb +53 -0
  88. data/upstream-lib/test_bench_bootstrap/test_bench/run/controls/summary.rb +45 -0
  89. data/upstream-lib/test_bench_bootstrap/test_bench/run/controls/telemetry.rb +11 -0
  90. data/upstream-lib/test_bench_bootstrap/test_bench/run/controls/time.rb +9 -0
  91. data/upstream-lib/test_bench_bootstrap/test_bench/run/controls.rb +20 -0
  92. data/upstream-lib/test_bench_bootstrap/test_bench/run/run.rb +146 -0
  93. data/upstream-lib/test_bench_bootstrap/test_bench/run/select_files/substitute.rb +45 -0
  94. data/upstream-lib/test_bench_bootstrap/test_bench/run/select_files.rb +70 -0
  95. data/upstream-lib/test_bench_bootstrap/test_bench/run/substitute.rb +42 -0
  96. data/upstream-lib/test_bench_bootstrap/test_bench/run/summary/substitute.rb +19 -0
  97. data/upstream-lib/test_bench_bootstrap/test_bench/run/summary.rb +477 -0
  98. data/upstream-lib/test_bench_bootstrap/test_bench/run.rb +10 -0
  99. data/upstream-lib/test_bench_bootstrap/test_bench/session/controls/backtrace/location.rb +48 -0
  100. data/upstream-lib/test_bench_bootstrap/test_bench/session/controls/backtrace.rb +83 -0
  101. data/upstream-lib/test_bench_bootstrap/test_bench/session/controls/comment_disposition.rb +17 -0
  102. data/upstream-lib/test_bench_bootstrap/test_bench/session/controls/event.rb +35 -0
  103. data/upstream-lib/test_bench_bootstrap/test_bench/session/controls/events/aborted.rb +51 -0
  104. data/upstream-lib/test_bench_bootstrap/test_bench/session/controls/events/commented.rb +62 -0
  105. data/upstream-lib/test_bench_bootstrap/test_bench/session/controls/events/context_finished.rb +112 -0
  106. data/upstream-lib/test_bench_bootstrap/test_bench/session/controls/events/context_started.rb +51 -0
  107. data/upstream-lib/test_bench_bootstrap/test_bench/session/controls/events/detailed.rb +62 -0
  108. data/upstream-lib/test_bench_bootstrap/test_bench/session/controls/events/failed.rb +41 -0
  109. data/upstream-lib/test_bench_bootstrap/test_bench/session/controls/events/file_executed.rb +101 -0
  110. data/upstream-lib/test_bench_bootstrap/test_bench/session/controls/events/file_not_found.rb +41 -0
  111. data/upstream-lib/test_bench_bootstrap/test_bench/session/controls/events/file_queued.rb +41 -0
  112. data/upstream-lib/test_bench_bootstrap/test_bench/session/controls/events/skipped.rb +51 -0
  113. data/upstream-lib/test_bench_bootstrap/test_bench/session/controls/events/test_finished.rb +92 -0
  114. data/upstream-lib/test_bench_bootstrap/test_bench/session/controls/events/test_started.rb +51 -0
  115. data/upstream-lib/test_bench_bootstrap/test_bench/session/controls/events.rb +35 -0
  116. data/upstream-lib/test_bench_bootstrap/test_bench/session/controls/exception/message.rb +23 -0
  117. data/upstream-lib/test_bench_bootstrap/test_bench/session/controls/exception/raise.rb +52 -0
  118. data/upstream-lib/test_bench_bootstrap/test_bench/session/controls/exception.rb +81 -0
  119. data/upstream-lib/test_bench_bootstrap/test_bench/session/controls/message.rb +43 -0
  120. data/upstream-lib/test_bench_bootstrap/test_bench/session/controls/metadata.rb +9 -0
  121. data/upstream-lib/test_bench_bootstrap/test_bench/session/controls/path/apex_directory.rb +76 -0
  122. data/upstream-lib/test_bench_bootstrap/test_bench/session/controls/path/file/create.rb +113 -0
  123. data/upstream-lib/test_bench_bootstrap/test_bench/session/controls/path/file.rb +42 -0
  124. data/upstream-lib/test_bench_bootstrap/test_bench/session/controls/path.rb +87 -0
  125. data/upstream-lib/test_bench_bootstrap/test_bench/session/controls/random.rb +9 -0
  126. data/upstream-lib/test_bench_bootstrap/test_bench/session/controls/result.rb +17 -0
  127. data/upstream-lib/test_bench_bootstrap/test_bench/session/controls/sequence.rb +13 -0
  128. data/upstream-lib/test_bench_bootstrap/test_bench/session/controls/status.rb +92 -0
  129. data/upstream-lib/test_bench_bootstrap/test_bench/session/controls/telemetry.rb +15 -0
  130. data/upstream-lib/test_bench_bootstrap/test_bench/session/controls/telemetry_sink.rb +37 -0
  131. data/upstream-lib/test_bench_bootstrap/test_bench/session/controls/text.rb +33 -0
  132. data/upstream-lib/test_bench_bootstrap/test_bench/session/controls/title.rb +41 -0
  133. data/upstream-lib/test_bench_bootstrap/test_bench/session/controls.rb +43 -0
  134. data/upstream-lib/test_bench_bootstrap/test_bench/session/defaults.rb +17 -0
  135. data/upstream-lib/test_bench_bootstrap/test_bench/session/events.rb +24 -0
  136. data/upstream-lib/test_bench_bootstrap/test_bench/session/exception/format_backtrace/substitute.rb +34 -0
  137. data/upstream-lib/test_bench_bootstrap/test_bench/session/exception/format_backtrace.rb +114 -0
  138. data/upstream-lib/test_bench_bootstrap/test_bench/session/isolate/substitute.rb +45 -0
  139. data/upstream-lib/test_bench_bootstrap/test_bench/session/isolate.rb +159 -0
  140. data/upstream-lib/test_bench_bootstrap/test_bench/session/result.rb +44 -0
  141. data/upstream-lib/test_bench_bootstrap/test_bench/session/session.rb +236 -0
  142. data/upstream-lib/test_bench_bootstrap/test_bench/session/status.rb +60 -0
  143. data/upstream-lib/test_bench_bootstrap/test_bench/session/substitute/sink.rb +99 -0
  144. data/upstream-lib/test_bench_bootstrap/test_bench/session/substitute.rb +154 -0
  145. data/upstream-lib/test_bench_bootstrap/test_bench/session/trace.rb +53 -0
  146. data/upstream-lib/test_bench_bootstrap/test_bench/session.rb +22 -0
  147. data/upstream-lib/test_bench_bootstrap/test_bench/telemetry/controls/event/metadata.rb +72 -0
  148. data/upstream-lib/test_bench_bootstrap/test_bench/telemetry/controls/event.rb +156 -0
  149. data/upstream-lib/test_bench_bootstrap/test_bench/telemetry/controls/event_data.rb +113 -0
  150. data/upstream-lib/test_bench_bootstrap/test_bench/telemetry/controls/handler.rb +83 -0
  151. data/upstream-lib/test_bench_bootstrap/test_bench/telemetry/controls/path/file.rb +39 -0
  152. data/upstream-lib/test_bench_bootstrap/test_bench/telemetry/controls/process_id.rb +25 -0
  153. data/upstream-lib/test_bench_bootstrap/test_bench/telemetry/controls/random.rb +11 -0
  154. data/upstream-lib/test_bench_bootstrap/test_bench/telemetry/controls/sink.rb +35 -0
  155. data/upstream-lib/test_bench_bootstrap/test_bench/telemetry/controls/time.rb +104 -0
  156. data/upstream-lib/test_bench_bootstrap/test_bench/telemetry/controls.rb +16 -0
  157. data/upstream-lib/test_bench_bootstrap/test_bench/telemetry/event.rb +130 -0
  158. data/upstream-lib/test_bench_bootstrap/test_bench/telemetry/event_data/serialization.rb +85 -0
  159. data/upstream-lib/test_bench_bootstrap/test_bench/telemetry/event_data.rb +15 -0
  160. data/upstream-lib/test_bench_bootstrap/test_bench/telemetry/sink/file.rb +39 -0
  161. data/upstream-lib/test_bench_bootstrap/test_bench/telemetry/sink/handler/event_registry.rb +44 -0
  162. data/upstream-lib/test_bench_bootstrap/test_bench/telemetry/sink/handler.rb +128 -0
  163. data/upstream-lib/test_bench_bootstrap/test_bench/telemetry/sink.rb +13 -0
  164. data/upstream-lib/test_bench_bootstrap/test_bench/telemetry/substitute/sink.rb +71 -0
  165. data/upstream-lib/test_bench_bootstrap/test_bench/telemetry/substitute.rb +43 -0
  166. data/upstream-lib/test_bench_bootstrap/test_bench/telemetry/telemetry.rb +92 -0
  167. data/upstream-lib/test_bench_bootstrap/test_bench/telemetry.rb +18 -0
  168. data/upstream-lib/test_bench_bootstrap/test_bench/test_bench.rb +72 -0
  169. data/upstream-lib/test_bench_bootstrap/test_bench.rb +4 -0
  170. metadata +353 -16
  171. data/lib/test_bench/bootstrap.rb +0 -328
@@ -0,0 +1,9 @@
1
+ module TestBenchBootstrap
2
+ module TestBench
3
+ module Fixture
4
+ module Controls
5
+ Exception = Session::Exception
6
+ end
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,69 @@
1
+ module TestBenchBootstrap
2
+ module TestBench
3
+ module Fixture
4
+ module Controls
5
+ module Fixture
6
+ def self.example
7
+ Example.new
8
+ end
9
+
10
+ class Example
11
+ include TestBench::Fixture
12
+
13
+ attr_accessor :actuated
14
+
15
+ attr_reader :some_argument
16
+ attr_reader :some_keyword_argument
17
+ attr_reader :some_block_argument
18
+
19
+ def initialize(some_argument=nil, some_keyword_argument: nil, &some_block_argument)
20
+ @some_argument = some_argument
21
+ @some_keyword_argument = some_keyword_argument
22
+ @some_block_argument = some_block_argument
23
+ end
24
+
25
+ def actuated?
26
+ actuated ? true : false
27
+ end
28
+
29
+ def call
30
+ self.actuated = true
31
+ end
32
+ end
33
+
34
+ class BuildMethod
35
+ include TestBench::Fixture
36
+
37
+ attr_accessor :some_argument
38
+ attr_accessor :some_optional_argument
39
+ attr_accessor :some_keyword_argument
40
+ attr_accessor :some_optional_keyword_argument
41
+ attr_accessor :some_block_argument
42
+
43
+ def self.build(some_argument, some_optional_argument=nil, some_keyword_argument:, some_optional_keyword_argument: nil, &some_block_argument)
44
+ instance = new
45
+
46
+ instance.some_argument = some_argument
47
+ instance.some_optional_argument = some_optional_argument
48
+ instance.some_keyword_argument = some_keyword_argument
49
+ instance.some_optional_keyword_argument = some_optional_keyword_argument
50
+ instance.some_block_argument = some_block_argument
51
+
52
+ instance
53
+ end
54
+ end
55
+
56
+ class NoBuildMethod
57
+ include TestBench::Fixture
58
+
59
+ attr_reader :some_argument
60
+
61
+ def initialize(some_argument)
62
+ @some_argument = some_argument
63
+ end
64
+ end
65
+ end
66
+ end
67
+ end
68
+ end
69
+ end
@@ -0,0 +1,9 @@
1
+ module TestBenchBootstrap
2
+ module TestBench
3
+ module Fixture
4
+ module Controls
5
+ Message = Session::Message
6
+ end
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,11 @@
1
+ module TestBenchBootstrap
2
+ module TestBench
3
+ module Fixture
4
+ module Controls
5
+ module Output
6
+ CommentStyle = TestBench::Output::Controls::CommentStyle
7
+ end
8
+ end
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,9 @@
1
+ module TestBenchBootstrap
2
+ module TestBench
3
+ module Fixture
4
+ module Controls
5
+ Path = Session::Path
6
+ end
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,21 @@
1
+ module TestBenchBootstrap
2
+ module TestBench
3
+ module Fixture
4
+ module Controls
5
+ module Session
6
+ Message = TestBench::Session::Controls::Message
7
+
8
+ Exception = TestBench::Session::Controls::Exception
9
+
10
+ Status = TestBench::Session::Controls::Status
11
+
12
+ Path = TestBench::Session::Controls::Path
13
+
14
+ Title = TestBench::Session::Controls::Title
15
+
16
+ Text = TestBench::Session::Controls::Text
17
+ end
18
+ end
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,9 @@
1
+ module TestBenchBootstrap
2
+ module TestBench
3
+ module Fixture
4
+ module Controls
5
+ Status = Session::Status
6
+ end
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,9 @@
1
+ module TestBenchBootstrap
2
+ module TestBench
3
+ module Fixture
4
+ module Controls
5
+ Text = Session::Text
6
+ end
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,9 @@
1
+ module TestBenchBootstrap
2
+ module TestBench
3
+ module Fixture
4
+ module Controls
5
+ Title = Session::Title
6
+ end
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,14 @@
1
+ require 'test_bench_bootstrap/test_bench/output/controls'
2
+
3
+ require 'test_bench_bootstrap/test_bench/fixture/controls/session'
4
+ require 'test_bench_bootstrap/test_bench/fixture/controls/output'
5
+
6
+ require 'test_bench_bootstrap/test_bench/fixture/controls/comment_style'
7
+ require 'test_bench_bootstrap/test_bench/fixture/controls/exception'
8
+ require 'test_bench_bootstrap/test_bench/fixture/controls/message'
9
+ require 'test_bench_bootstrap/test_bench/fixture/controls/path'
10
+ require 'test_bench_bootstrap/test_bench/fixture/controls/status'
11
+ require 'test_bench_bootstrap/test_bench/fixture/controls/text'
12
+ require 'test_bench_bootstrap/test_bench/fixture/controls/title'
13
+
14
+ require 'test_bench_bootstrap/test_bench/fixture/controls/fixture'
@@ -0,0 +1,37 @@
1
+ module TestBenchBootstrap
2
+ module TestBench
3
+ module Fixture
4
+ class Evaluate
5
+ include Fixture
6
+
7
+ attr_reader :block
8
+
9
+ def initialize(block)
10
+ @block = block
11
+ end
12
+
13
+ def self.build(test_session:, &block)
14
+ instance = new(block)
15
+
16
+ Session.configure(
17
+ instance,
18
+ session: test_session,
19
+ attr_name: :test_session
20
+ )
21
+
22
+ instance
23
+ end
24
+
25
+ def self.call(test_session: nil, &block)
26
+ instance = build(test_session:, &block)
27
+ instance.()
28
+ instance
29
+ end
30
+
31
+ def call
32
+ instance_exec(&block)
33
+ end
34
+ end
35
+ end
36
+ end
37
+ end
@@ -0,0 +1,213 @@
1
+ module TestBenchBootstrap
2
+ module TestBench
3
+ module Fixture
4
+ def test_session
5
+ @test_session ||= Session::Substitute.build
6
+ end
7
+ attr_writer :test_session
8
+
9
+ def self.assure_boolean(value, message_subject)
10
+ if not value == true || value == false
11
+ raise Session::Failure, "#{message_subject} given non-boolean value: #{value.inspect}"
12
+ end
13
+
14
+ return "#{message_subject} failed"
15
+ end
16
+
17
+ def assert(value)
18
+ failure_message = Fixture.assure_boolean(value, "Assertion")
19
+
20
+ test_session.assert(value, failure_message)
21
+ end
22
+
23
+ def refute(value)
24
+ failure_message = Fixture.assure_boolean(value, "Refutation")
25
+
26
+ negated_value = !value
27
+
28
+ test_session.assert(negated_value, failure_message)
29
+ end
30
+
31
+ def assert_raises(exception_class=nil, message=nil, strict: nil, &block)
32
+ if exception_class.nil?
33
+ strict = false
34
+ exception_class = StandardError
35
+ end
36
+
37
+ if strict.nil?
38
+ strict = true
39
+ end
40
+
41
+ test_session.detail "Expected exception: #{exception_class}#{' (strict)' if strict}"
42
+ if not message.nil?
43
+ test_session.detail "Expected message: #{message.inspect}"
44
+ end
45
+
46
+ block.()
47
+
48
+ rescue exception_class => exception
49
+ test_session.detail "Raised exception: #{exception.inspect}#{" (subclass of #{exception_class})" if exception.class < exception_class}"
50
+
51
+ if strict && !exception.instance_of?(exception_class)
52
+ raise
53
+ end
54
+
55
+ if not message.nil?
56
+ assert(exception.message == message)
57
+ else
58
+ assert(true)
59
+ end
60
+
61
+ else
62
+ test_session.detail "(No exception was raised)"
63
+ assert(false)
64
+ end
65
+
66
+ def refute_raises(exception_class=nil, strict: nil, &block)
67
+ if exception_class.nil?
68
+ strict = false
69
+ exception_class = StandardError
70
+ end
71
+
72
+ if strict.nil?
73
+ strict = true
74
+ end
75
+
76
+ test_session.detail "Prohibited exception: #{exception_class}#{' (strict)' if strict}"
77
+
78
+ block.()
79
+
80
+ rescue exception_class => exception
81
+
82
+ test_session.detail "Raised exception: #{exception.inspect}#{" (subclass of #{exception_class})" if exception.class < exception_class}"
83
+
84
+ if strict && !exception.instance_of?(exception_class)
85
+ raise
86
+ end
87
+
88
+ assert(false)
89
+
90
+ else
91
+ test_session.detail "(No exception was raised)"
92
+ assert(true)
93
+ end
94
+
95
+ def self.comment_text_and_disposition(text_or_fixture, style: nil, disposition: nil)
96
+ case text_or_fixture
97
+ in String => text
98
+ style ||= Output::CommentStyle.detect
99
+
100
+ in Fixture => fixture
101
+ style ||= Output::CommentStyle.block
102
+
103
+ test_session = fixture.test_session
104
+
105
+ text = Output::Get.(test_session)
106
+
107
+ in Object => object
108
+ style ||= Output::CommentStyle.detect
109
+
110
+ text = String.try_convert(object)
111
+ if text.nil?
112
+ raise TypeError, "no implicit conversion of #{object.class} into String"
113
+ end
114
+ end
115
+
116
+ disposition ||= Output::CommentStyle.get_disposition(style)
117
+
118
+ return text, disposition
119
+ end
120
+
121
+ def comment(heading_text=nil, text_or_fixture, style: nil, disposition: nil)
122
+ if not heading_text.nil?
123
+ heading_style = Output::CommentStyle.heading
124
+
125
+ comment(heading_text, style: heading_style)
126
+ end
127
+
128
+ text, disposition = Fixture.comment_text_and_disposition(text_or_fixture, style:, disposition:)
129
+
130
+ test_session.comment(text, disposition)
131
+ end
132
+
133
+ def detail(heading_text=nil, text_or_fixture, style: nil, disposition: nil)
134
+ if not heading_text.nil?
135
+ heading_style = Output::CommentStyle.heading
136
+
137
+ detail(heading_text, style: heading_style)
138
+ end
139
+
140
+ text, disposition = Fixture.comment_text_and_disposition(text_or_fixture, style:, disposition:)
141
+
142
+ test_session.detail(text, disposition)
143
+ end
144
+
145
+ def self.title(title)
146
+ if title.nil? || title.instance_of?(String)
147
+ return title
148
+ end
149
+
150
+ title_string = String.try_convert(title)
151
+ if title_string.nil?
152
+ raise TypeError, "can't convert #{title.class} into #{String}"
153
+ end
154
+
155
+ title_string
156
+ end
157
+
158
+ def test(title=nil, &block)
159
+ title = Fixture.title(title)
160
+
161
+ if block.nil?
162
+ skip_message = title
163
+ test_session.skip(skip_message)
164
+ return nil
165
+ end
166
+
167
+ result = test_session.test(title, &block)
168
+
169
+ Session::Result.resolve(result, strict: true)
170
+ end
171
+
172
+ def test!(...)
173
+ if not test(...)
174
+ throw(Session::ExecutionBreak)
175
+ end
176
+ end
177
+
178
+ def context(title=nil, &block)
179
+ title = Fixture.title(title)
180
+
181
+ if block.nil?
182
+ skip_message = title
183
+ test_session.skip(skip_message)
184
+ return nil
185
+ end
186
+
187
+ result = test_session.context(title, &block)
188
+
189
+ Session::Result.resolve(result, strict: true)
190
+ end
191
+
192
+ def context!(...)
193
+ if not context(...)
194
+ throw(Session::ExecutionBreak)
195
+ end
196
+ end
197
+
198
+ def execute(file_path)
199
+ test_session.execute(file_path)
200
+ end
201
+
202
+ def fixture(fixture_class, *, test_session: nil, **, &)
203
+ test_session ||= self.test_session
204
+
205
+ fixture = Build.(fixture_class, *, test_session:, **, &)
206
+
207
+ fixture.()
208
+
209
+ fixture
210
+ end
211
+ end
212
+ end
213
+ end
@@ -0,0 +1,7 @@
1
+ require 'test_bench_bootstrap/test_bench/output'
2
+
3
+ require 'test_bench_bootstrap/test_bench/fixture/build'
4
+
5
+ require 'test_bench_bootstrap/test_bench/fixture/evaluate'
6
+
7
+ require 'test_bench_bootstrap/test_bench/fixture/fixture'
@@ -0,0 +1,63 @@
1
+ module TestBenchBootstrap
2
+ module TestBench
3
+ class Output
4
+ module CommentStyle
5
+ Error = Class.new(RuntimeError)
6
+
7
+ def self.fetch(comment_disposition)
8
+ comment_style = get(comment_disposition)
9
+
10
+ comment_style ||= normal
11
+
12
+ comment_style
13
+ end
14
+
15
+ def self.get(comment_disposition)
16
+ comment_style, _ = comment_styles.rassoc(comment_disposition)
17
+ comment_style
18
+ end
19
+
20
+ def self.get_disposition(comment_style)
21
+ comment_styles.fetch(comment_style) do
22
+ raise Error, "Incorrect comment style: #{comment_style.inspect}"
23
+ end
24
+ end
25
+
26
+ def self.comment_styles
27
+ {
28
+ :detect => 'detect',
29
+ :normal => 'normal',
30
+ :heading => 'heading',
31
+ :block => 'block',
32
+ :line_number => 'line_number',
33
+ :raw => 'raw'
34
+ }
35
+ end
36
+
37
+ def self.detect
38
+ :detect
39
+ end
40
+
41
+ def self.normal
42
+ :normal
43
+ end
44
+
45
+ def self.heading
46
+ :heading
47
+ end
48
+
49
+ def self.block
50
+ :block
51
+ end
52
+
53
+ def self.line_number
54
+ :line_number
55
+ end
56
+
57
+ def self.raw
58
+ :raw
59
+ end
60
+ end
61
+ end
62
+ end
63
+ end
@@ -0,0 +1,23 @@
1
+ module TestBenchBootstrap
2
+ module TestBench
3
+ class Output
4
+ module Controls
5
+ module CommentStyle
6
+ def self.example
7
+ :normal
8
+ end
9
+
10
+ def self.disposition
11
+ 'normal'
12
+ end
13
+
14
+ module Disposition
15
+ def self.example
16
+ Session::CommentDisposition.example
17
+ end
18
+ end
19
+ end
20
+ end
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,9 @@
1
+ module TestBenchBootstrap
2
+ module TestBench
3
+ class Output
4
+ module Controls
5
+ Event = Session::Event
6
+ end
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,11 @@
1
+ module TestBenchBootstrap
2
+ module TestBench
3
+ class Output
4
+ module Controls
5
+ module Events
6
+ Aborted = Session::Events::Aborted
7
+ end
8
+ end
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,23 @@
1
+ module TestBenchBootstrap
2
+ module TestBench
3
+ class Output
4
+ module Controls
5
+ module Events
6
+ module Commented
7
+ def self.example(text: nil, style: nil)
8
+ style ||= self.style
9
+
10
+ disposition = Output::CommentStyle.get_disposition(style)
11
+
12
+ Session::Events::Commented.example(text:, disposition:)
13
+ end
14
+
15
+ def self.style
16
+ CommentStyle.example
17
+ end
18
+ end
19
+ end
20
+ end
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,11 @@
1
+ module TestBenchBootstrap
2
+ module TestBench
3
+ class Output
4
+ module Controls
5
+ module Events
6
+ ContextFinished = Session::Events::ContextFinished
7
+ end
8
+ end
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,11 @@
1
+ module TestBenchBootstrap
2
+ module TestBench
3
+ class Output
4
+ module Controls
5
+ module Events
6
+ ContextStarted = Session::Events::ContextStarted
7
+ end
8
+ end
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,23 @@
1
+ module TestBenchBootstrap
2
+ module TestBench
3
+ class Output
4
+ module Controls
5
+ module Events
6
+ module Detailed
7
+ def self.example(text: nil, style: nil)
8
+ style ||= self.style
9
+
10
+ disposition = Output::CommentStyle.get_disposition(style)
11
+
12
+ Session::Events::Detailed.example(text:, disposition:)
13
+ end
14
+
15
+ def self.style
16
+ CommentStyle.example
17
+ end
18
+ end
19
+ end
20
+ end
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,11 @@
1
+ module TestBenchBootstrap
2
+ module TestBench
3
+ class Output
4
+ module Controls
5
+ module Events
6
+ Failed = Session::Events::Failed
7
+ end
8
+ end
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,11 @@
1
+ module TestBenchBootstrap
2
+ module TestBench
3
+ class Output
4
+ module Controls
5
+ module Events
6
+ FileExecuted = Session::Events::FileExecuted
7
+ end
8
+ end
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,11 @@
1
+ module TestBenchBootstrap
2
+ module TestBench
3
+ class Output
4
+ module Controls
5
+ module Events
6
+ FileNotFound = Session::Events::FileNotFound
7
+ end
8
+ end
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,11 @@
1
+ module TestBenchBootstrap
2
+ module TestBench
3
+ class Output
4
+ module Controls
5
+ module Events
6
+ FileQueued = Session::Events::FileQueued
7
+ end
8
+ end
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,11 @@
1
+ module TestBenchBootstrap
2
+ module TestBench
3
+ class Output
4
+ module Controls
5
+ module Events
6
+ Skipped = Session::Events::Skipped
7
+ end
8
+ end
9
+ end
10
+ end
11
+ end