test_bench 1.0.0.1 → 1.2.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (35) hide show
  1. checksums.yaml +4 -4
  2. data/lib/test_bench.rb +9 -9
  3. data/lib/test_bench/cli.rb +2 -2
  4. data/lib/test_bench/cli/parse_arguments.rb +33 -20
  5. data/lib/test_bench/controls.rb +5 -1
  6. data/lib/test_bench/controls/output/batch_data.rb +52 -0
  7. data/lib/test_bench/controls/output/detail_setting.rb +29 -0
  8. data/lib/test_bench/controls/output/exercise.rb +7 -0
  9. data/lib/test_bench/controls/output/log_level.rb +7 -0
  10. data/lib/test_bench/controls/output/summary/error.rb +0 -16
  11. data/lib/test_bench/controls/output/summary/session.rb +20 -0
  12. data/lib/test_bench/controls/pattern.rb +6 -2
  13. data/lib/test_bench/controls/time.rb +18 -0
  14. data/lib/test_bench/deactivation_variants.rb +0 -10
  15. data/lib/test_bench/output.rb +14 -2
  16. data/lib/test_bench/output/batch_data.rb +17 -0
  17. data/lib/test_bench/output/buffer.rb +114 -0
  18. data/lib/test_bench/output/log.rb +27 -0
  19. data/lib/test_bench/output/raw.rb +353 -0
  20. data/lib/test_bench/output/summary.rb +146 -0
  21. data/lib/test_bench/output/summary/session.rb +94 -0
  22. data/lib/test_bench/output/writer.rb +2 -2
  23. data/lib/test_bench/run.rb +9 -9
  24. data/lib/test_bench/test_bench.rb +31 -3
  25. metadata +18 -17
  26. data/lib/test_bench/controls/output/summary/run.rb +0 -59
  27. data/lib/test_bench/output/build.rb +0 -57
  28. data/lib/test_bench/output/levels/debug.rb +0 -229
  29. data/lib/test_bench/output/levels/failure.rb +0 -31
  30. data/lib/test_bench/output/levels/none.rb +0 -13
  31. data/lib/test_bench/output/levels/pass.rb +0 -286
  32. data/lib/test_bench/output/levels/summary.rb +0 -21
  33. data/lib/test_bench/output/summary/error.rb +0 -77
  34. data/lib/test_bench/output/summary/run.rb +0 -102
  35. data/lib/test_bench/output/summary/run/print.rb +0 -98
@@ -1,98 +0,0 @@
1
- module TestBench
2
- module Output
3
- module Summary
4
- module Run
5
- module Print
6
- extend self
7
-
8
- def call(file_count: nil, test_count: nil, pass_count: nil, skip_count: nil, failure_count: nil, error_count: nil, elapsed_time: nil, writer: nil)
9
- file_count ||= 0
10
- test_count ||= 0
11
- pass_count ||= 0
12
- skip_count ||= 0
13
- failure_count ||= 0
14
- error_count ||= 0
15
- elapsed_time ||= 0
16
- writer ||= Writer.build
17
-
18
- failed = error_count > 0
19
-
20
- if elapsed_time.nonzero?
21
- tests_per_second = test_count / elapsed_time
22
- end
23
-
24
- if failed
25
- writer.escape_code(:red)
26
- end
27
-
28
- writer
29
- .text("Finished running #{numeric_label(file_count, 'file')}")
30
- .newline
31
- .text("Ran %s in %.3fs (%.1f tests/second)" % [
32
- numeric_label(test_count, 'test'),
33
- elapsed_time,
34
- tests_per_second || 0])
35
- .newline
36
-
37
- if pass_count.nonzero? && !failed
38
- writer
39
- .escape_code(:green)
40
- .text("#{pass_count} passed")
41
- .escape_code(:reset_fg)
42
- else
43
- writer.text("#{pass_count} passed")
44
- end
45
-
46
- writer.text(", ")
47
-
48
- if skip_count.nonzero? && !failed
49
- writer
50
- .escape_code(:yellow)
51
- .text("#{skip_count} skipped")
52
- .escape_code(:reset_fg)
53
- else
54
- writer.text("#{skip_count} skipped")
55
- end
56
-
57
- writer.text(", ")
58
-
59
- if failure_count.nonzero?
60
- writer
61
- .escape_code(:bold)
62
- .text("#{failure_count} failed")
63
- .escape_code(:reset_intensity)
64
- else
65
- writer.text("0 failed")
66
- end
67
-
68
- writer.text(", ")
69
-
70
- if failed
71
- writer
72
- .escape_code(:bold)
73
- .text(numeric_label(error_count, 'total error'))
74
- .escape_code(:reset_intensity)
75
- .escape_code(:reset_fg)
76
- else
77
- writer.text("0 total errors")
78
- end
79
-
80
- 2.times do
81
- writer.newline
82
- end
83
- end
84
-
85
- def numeric_label(number, label, plural_text=nil)
86
- plural_text ||= 's'
87
-
88
- if number == 1
89
- "#{number} #{label}"
90
- else
91
- "#{number} #{label}#{plural_text}"
92
- end
93
- end
94
- end
95
- end
96
- end
97
- end
98
- end