test-unit 3.5.3 → 3.5.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3a763b935a0a7386519019ce4dc198a3ba9f0dd00f9f44a10cb887d48f2b9d2e
4
- data.tar.gz: a7b94931289833bc8406c5b07421425110a37ff9a099c43257a83e9b3759a7f0
3
+ metadata.gz: 4afce440e8f42a765407acb64e5f6791802bf32bccdc81cd31b910fbc5e85b36
4
+ data.tar.gz: 2f80c85f0fccdf7080a28d5663238121e21e449c332fd1fbd336de77e6f58c08
5
5
  SHA512:
6
- metadata.gz: c4cda5342ca0dee7d082e7a61c41a16e532a270848c5944cad33b04fac1cc4b4eaafc3952fba1e8035f2a2f23dd0ef71adf01262210c8f4df860ef155e92cefd
7
- data.tar.gz: a28acd0a86eaab701fc1bcc4682e17d1ddd2298fa34e2e292fffe488995f257b728fb0aaedb9d9e0511316dd411b9d44a09d59084c91997e190fef55a2b3ce14
6
+ metadata.gz: 5a3aed37e966fb5756a9a6ee2db2a863254f4c49138ce21e0a642328beb24bf650850d00c9aac2b65b45885f4c0ea42aff5df3c9a6abcb5cce29659f538de539
7
+ data.tar.gz: 78cbacaa7f92f73e51fae1e3c0fc8de5105d6c8c5bc5cf9002f2350c7eaa7633f9a74dcdfed74791ff0bb8bea7b0d2661ee4ac03b607b22c8f91da35ea1665ef
data/README.md CHANGED
@@ -2,7 +2,6 @@
2
2
 
3
3
  [![Gem Version](https://badge.fury.io/rb/test-unit.png)](http://badge.fury.io/rb/test-unit)
4
4
  [![Build Status for Ruby 2.1+](https://github.com/test-unit/test-unit/actions/workflows/test.yml/badge.svg?branch=master)](https://github.com/test-unit/test-unit/actions/workflows/test.yml?query=branch%3Amaster+)
5
- [![Build Status for Ruby 1.9 and 2.0](https://travis-ci.com/test-unit/test-unit.svg?branch=master)](https://travis-ci.com/test-unit/test-unit)
6
5
 
7
6
  * http://test-unit.github.io/
8
7
  * https://github.com/test-unit/test-unit
@@ -16,6 +15,17 @@ principles. These were originally designed by Kent Beck, creator of extreme
16
15
  programming software development methodology, for Smalltalk's SUnit. It allows
17
16
  writing tests, checking results and automated testing in Ruby.
18
17
 
18
+ test-unit ships as part of Ruby as a bundled gem. To check which version is included, see https://stdgems.org/test-unit/.
19
+ It's only necessary to install the gem if you need a newer version.
20
+
21
+ test-unit is the original Ruby unit testing library, and is still active.
22
+ It is one of two unit testing libraries bundled with Ruby, the other being [minitest](https://github.com/seattlerb/minitest).
23
+
24
+ When deciding which to use, consider:
25
+
26
+ * test-unit is strict about backwards compatibility. A backwards-incompatible change would be considered a bug.
27
+ * test-unit aims to support old Ruby versions, even if EOL.
28
+
19
29
  ## Features
20
30
 
21
31
  * test-unit 1.2.3 is the original test-unit, taken
@@ -243,4 +243,4 @@ end
243
243
 
244
244
  Let's read the official document.
245
245
 
246
- * [test-unit](http://test-unit.github.io/index.html)
246
+ * [test-unit](https://test-unit.github.io/index.html)
data/doc/text/news.md CHANGED
@@ -1,5 +1,21 @@
1
1
  # News
2
2
 
3
+ ## 3.5.4 - 2022-10-04 {#version-3-5-4}
4
+
5
+ ### Improvements
6
+
7
+ * Don't raise an error on `Test::Unit::TestCase.clone`.
8
+ [GitHub#210][Reported by David Marchaland]
9
+
10
+ * Added support for `BigDeciaml` in `assert_in_delta` family.
11
+ [GitHub#218][Patch by Kenta Murata]
12
+
13
+ ### Thanks
14
+
15
+ * David Marchaland
16
+
17
+ * Kenta Murata
18
+
3
19
  ## 3.5.3 - 2021-12-20 {#version-3-5-3}
4
20
 
5
21
  ### Improvements
@@ -1550,7 +1566,7 @@ Output improvement release!
1550
1566
  * use ~/.test-unit.yml as global configuration file.
1551
1567
  * add TAP runner. (--runner tap)
1552
1568
  * support colorized diff:
1553
- http://test-unit.github.io/color-diff.png
1569
+ https://test-unit.github.io/color-diff.png
1554
1570
  * add Test::Unit::AutoRunner.default_runner= to specify default test runner.
1555
1571
 
1556
1572
  * 4 minor enhancements
@@ -926,15 +926,37 @@ EOT
926
926
  # assert_in_delta 0.05, (50000.0 / 10**6), 0.00001
927
927
  def assert_in_delta(expected_float, actual_float, delta=0.001, message="")
928
928
  _wrap_assertion do
929
- _assert_in_delta_validate_arguments(expected_float,
930
- actual_float,
931
- delta)
932
- full_message = _assert_in_delta_message(expected_float,
933
- actual_float,
934
- delta,
935
- message)
929
+ begin
930
+ pass = delta >= (expected_float - actual_float).abs
931
+ assert_operator(delta, :>=, 0.0, "The delta should not be negative")
932
+ full_message = _assert_in_delta_message(expected_float,
933
+ expected_float,
934
+ actual_float,
935
+ actual_float,
936
+ delta,
937
+ delta,
938
+ message)
939
+ rescue Test::Unit::AssertionFailedError
940
+ # for the above assert_operator
941
+ raise
942
+ rescue
943
+ _assert_in_delta_validate_arguments(expected_float,
944
+ actual_float,
945
+ delta)
946
+ normalized_expected = expected_float.to_f
947
+ normalized_actual = actual_float.to_f
948
+ normalized_delta = delta.to_f
949
+ pass = (normalized_expected - normalized_actual).abs <= normalized_delta
950
+ full_message = _assert_in_delta_message(expected_float,
951
+ normalized_expected,
952
+ actual_float,
953
+ normalized_actual,
954
+ delta,
955
+ normalized_delta,
956
+ message)
957
+ end
936
958
  assert_block(full_message) do
937
- (expected_float.to_f - actual_float.to_f).abs <= delta.to_f
959
+ pass
938
960
  end
939
961
  end
940
962
  end
@@ -951,13 +973,32 @@ EOT
951
973
  _assert_in_delta_validate_arguments(expected_float,
952
974
  actual_float,
953
975
  delta)
954
- full_message = _assert_in_delta_message(expected_float,
955
- actual_float,
956
- delta,
957
- message,
958
- :negative_assertion => true)
976
+ begin
977
+ pass = (expected_float - actual_float).abs > delta
978
+ full_message = _assert_in_delta_message(expected_float,
979
+ expected_float,
980
+ actual_float,
981
+ actual_float,
982
+ delta,
983
+ delta,
984
+ message,
985
+ :negative_assertion => true)
986
+ rescue
987
+ normalized_expected = expected_float.to_f
988
+ normalized_actual = actual_float.to_f
989
+ normalized_delta = delta.to_f
990
+ pass = (normalized_expected - normalized_actual).abs > normalized_delta
991
+ full_message = _assert_in_delta_message(expected_float,
992
+ normalized_expected,
993
+ actual_float,
994
+ normalized_actual,
995
+ delta,
996
+ normalized_delta,
997
+ message,
998
+ :negative_assertion => true)
999
+ end
959
1000
  assert_block(full_message) do
960
- (expected_float.to_f - actual_float.to_f).abs > delta.to_f
1001
+ pass
961
1002
  end
962
1003
  end
963
1004
  end
@@ -984,7 +1025,9 @@ EOT
984
1025
  assert_operator(delta, :>=, 0.0, "The delta should not be negative")
985
1026
  end
986
1027
 
987
- def _assert_in_delta_message(expected_float, actual_float, delta,
1028
+ def _assert_in_delta_message(expected_float, normalized_expected,
1029
+ actual_float, normalized_actual,
1030
+ delta, normalized_delta,
988
1031
  message, options={})
989
1032
  if options[:negative_assertion]
990
1033
  format = <<-EOT
@@ -998,9 +1041,6 @@ EOT
998
1041
  EOT
999
1042
  end
1000
1043
  arguments = [expected_float, delta, actual_float]
1001
- normalized_expected = expected_float.to_f
1002
- normalized_actual = actual_float.to_f
1003
- normalized_delta = delta.to_f
1004
1044
  relation_format = nil
1005
1045
  relation_arguments = nil
1006
1046
  if normalized_actual < normalized_expected - normalized_delta
@@ -1049,22 +1089,52 @@ EOT
1049
1089
  def assert_in_epsilon(expected_float, actual_float, epsilon=0.001,
1050
1090
  message="")
1051
1091
  _wrap_assertion do
1052
- _assert_in_epsilon_validate_arguments(expected_float,
1053
- actual_float,
1054
- epsilon)
1055
- full_message = _assert_in_epsilon_message(expected_float,
1056
- actual_float,
1057
- epsilon,
1058
- message)
1059
- assert_block(full_message) do
1060
- normalized_expected_float = expected_float.to_f
1061
- if normalized_expected_float.zero?
1062
- delta = epsilon.to_f ** 2
1092
+ begin
1093
+ zero_p = expected_float.zero? rescue expected_float == 0
1094
+ if zero_p
1095
+ delta = epsilon ** 2
1063
1096
  else
1064
- delta = normalized_expected_float * epsilon.to_f
1097
+ delta = expected_float * epsilon
1065
1098
  end
1066
1099
  delta = delta.abs
1067
- (normalized_expected_float - actual_float.to_f).abs <= delta
1100
+ pass = (expected_float - actual_float).abs <= delta
1101
+ assert_operator(epsilon, :>=, 0.0, "The epsilon should not be negative")
1102
+ full_message = _assert_in_epsilon_message(expected_float,
1103
+ expected_float,
1104
+ actual_float,
1105
+ actual_float,
1106
+ epsilon,
1107
+ epsilon,
1108
+ delta,
1109
+ message)
1110
+ rescue Test::Unit::AssertionFailedError
1111
+ # for the above assert_operator
1112
+ raise
1113
+ rescue
1114
+ _assert_in_epsilon_validate_arguments(expected_float,
1115
+ actual_float,
1116
+ epsilon)
1117
+ normalized_expected = expected_float.to_f
1118
+ normalized_actual = actual_float.to_f
1119
+ normalized_epsilon = epsilon.to_f
1120
+ if normalized_expected.zero?
1121
+ delta = normalized_epsilon ** 2
1122
+ else
1123
+ delta = normalized_expected * normalized_epsilon
1124
+ end
1125
+ delta = delta.abs
1126
+ full_message = _assert_in_epsilon_message(expected_float,
1127
+ normalized_expected,
1128
+ actual_float,
1129
+ normalized_actual,
1130
+ epsilon,
1131
+ normalized_epsilon,
1132
+ delta,
1133
+ message)
1134
+ pass = (normalized_expected - normalized_actual).abs <= delta
1135
+ end
1136
+ assert_block(full_message) do
1137
+ pass
1068
1138
  end
1069
1139
  end
1070
1140
  end
@@ -1080,18 +1150,43 @@ EOT
1080
1150
  def assert_not_in_epsilon(expected_float, actual_float, epsilon=0.001,
1081
1151
  message="")
1082
1152
  _wrap_assertion do
1083
- _assert_in_epsilon_validate_arguments(expected_float,
1084
- actual_float,
1085
- epsilon)
1086
- full_message = _assert_in_epsilon_message(expected_float,
1087
- actual_float,
1088
- epsilon,
1089
- message,
1090
- :negative_assertion => true)
1153
+ begin
1154
+ delta = expected_float * epsilon
1155
+ pass = (expected_float - actual_float).abs > delta
1156
+ assert_operator(epsilon, :>=, 0.0, "The epsilon should not be negative")
1157
+ full_message = _assert_in_epsilon_message(expected_float,
1158
+ expected_float,
1159
+ actual_float,
1160
+ actual_float,
1161
+ epsilon,
1162
+ epsilon,
1163
+ delta,
1164
+ message,
1165
+ :negative_assertion => true)
1166
+ rescue Test::Unit::AssertionFailedError
1167
+ # for the above assert_operator
1168
+ raise
1169
+ rescue
1170
+ _assert_in_epsilon_validate_arguments(expected_float,
1171
+ actual_float,
1172
+ epsilon)
1173
+ normalized_expected = expected_float.to_f
1174
+ normalized_actual = actual_float.to_f
1175
+ normalized_epsilon = epsilon.to_f
1176
+ delta = normalized_expected * normalized_epsilon
1177
+ pass = (normalized_expected - normalized_actual).abs > delta
1178
+ full_message = _assert_in_epsilon_message(expected_float,
1179
+ normalized_expected,
1180
+ actual_float,
1181
+ normalized_actual,
1182
+ epsilon,
1183
+ normalized_epsilon,
1184
+ delta,
1185
+ message,
1186
+ :negative_assertion => true)
1187
+ end
1091
1188
  assert_block(full_message) do
1092
- normalized_expected_float = expected_float.to_f
1093
- delta = normalized_expected_float * epsilon.to_f
1094
- (normalized_expected_float - actual_float.to_f).abs > delta
1189
+ pass
1095
1190
  end
1096
1191
  end
1097
1192
  end
@@ -1118,13 +1213,10 @@ EOT
1118
1213
  assert_operator(epsilon, :>=, 0.0, "The epsilon should not be negative")
1119
1214
  end
1120
1215
 
1121
- def _assert_in_epsilon_message(expected_float, actual_float, epsilon,
1122
- message, options={})
1123
- normalized_expected = expected_float.to_f
1124
- normalized_actual = actual_float.to_f
1125
- normalized_epsilon = epsilon.to_f
1126
- delta = normalized_expected * normalized_epsilon
1127
-
1216
+ def _assert_in_epsilon_message(expected_float, normalized_expected,
1217
+ actual_float, normalized_actual,
1218
+ epsilon, normalized_epsilon,
1219
+ delta, message, options={})
1128
1220
  if options[:negative_assertion]
1129
1221
  format = <<-EOT
1130
1222
  <?> -/+ (<?> * <?>)[?] was expected to not include
@@ -199,6 +199,7 @@ module Test
199
199
  ancestor.is_a?(Class) and
200
200
  ancestor < Test::Unit::Attribute
201
201
  end
202
+ return nil if @cached_parent_test.nil?
202
203
 
203
204
  @cached_parent_test_case.find_attribute(method_name, name, options)
204
205
  end
@@ -1,5 +1,5 @@
1
1
  module Test
2
2
  module Unit
3
- VERSION = "3.5.3"
3
+ VERSION = "3.5.4"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,15 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: test-unit
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.5.3
4
+ version: 3.5.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kouhei Sutou
8
8
  - Haruka Yoshihara
9
- autorequire:
9
+ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2021-12-19 00:00:00.000000000 Z
12
+ date: 2022-10-04 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: power_assert
@@ -95,7 +95,7 @@ dependencies:
95
95
  - - ">="
96
96
  - !ruby/object:Gem::Version
97
97
  version: '0'
98
- description: |
98
+ description: |-
99
99
  test-unit (Test::Unit) is unit testing framework for Ruby, based on xUnit
100
100
  principles. These were originally designed by Kent Beck, creator of extreme
101
101
  programming software development methodology, for Smalltalk's SUnit. It allows
@@ -180,7 +180,7 @@ metadata:
180
180
  source_code_uri: https://github.com/test-unit/test-unit
181
181
  documentation_uri: https://test-unit.github.io/test-unit/en/
182
182
  bug_tracker_uri: https://github.com/test-unit/test-unit/issues
183
- post_install_message:
183
+ post_install_message:
184
184
  rdoc_options: []
185
185
  require_paths:
186
186
  - lib
@@ -195,8 +195,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
195
195
  - !ruby/object:Gem::Version
196
196
  version: '0'
197
197
  requirements: []
198
- rubygems_version: 3.3.0.dev
199
- signing_key:
198
+ rubygems_version: 3.4.0.dev
199
+ signing_key:
200
200
  specification_version: 4
201
201
  summary: An xUnit family unit testing framework for Ruby.
202
202
  test_files: []