Skip to content

Commit e185203

Browse files
committed
Migrate tests to Rust nightly 1.73.
Upstream changes: - "Stabilize thread local cell methods." rust-lang/rust#114689 - "Cleaner assert_eq! & assert_ne! panic messages" rust-lang/rust#111071
1 parent 9f6ebc0 commit e185203

File tree

6 files changed

+95
-95
lines changed

6 files changed

+95
-95
lines changed

src/arithmetic/fixed.rs

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -348,9 +348,9 @@ mod test {
348348
test_is_exact,
349349
test_ceil_precision,
350350
test_ratio,
351-
test_ratio_invert => fail(r"assertion failed: `(left == right)`
352-
left: `FixedDecimal9(999999999)`,
353-
right: `FixedDecimal9(1000000000)`: R::ratio(1, a) * a != 1 for 3"),
351+
test_ratio_invert => fail(r"assertion `left == right` failed: R::ratio(1, a) * a != 1 for 3
352+
left: FixedDecimal9(999999999)
353+
right: FixedDecimal9(1000000000)"),
354354
test_is_zero,
355355
test_zero_is_add_neutral,
356356
test_add_is_commutative,
@@ -363,18 +363,18 @@ mod test {
363363
test_mul_up_is_commutative,
364364
test_mul_up_integers,
365365
test_mul_up_wrt_mul,
366-
test_invert => fail(r"assertion failed: `(left == right)`
367-
left: `FixedDecimal9(2147483649)`,
368-
right: `FixedDecimal9(2147483646)`: 1/(1/a) != a for 2.147483646"),
366+
test_invert => fail(r"assertion `left == right` failed: 1/(1/a) != a for 2.147483646
367+
left: FixedDecimal9(2147483649)
368+
right: FixedDecimal9(2147483646)"),
369369
test_div_self,
370370
test_div_up_self,
371371
test_div_up_wrt_div,
372-
test_mul_div => fail(r"assertion failed: `(left == right)`
373-
left: `FixedDecimal9(0)`,
374-
right: `FixedDecimal9(1)`: (a * b) / b != a for 0.000000001, 0.000000001"),
375-
test_div_mul => fail(r"assertion failed: `(left == right)`
376-
left: `FixedDecimal9(0)`,
377-
right: `FixedDecimal9(1)`: (a / b) * b != a for 0.000000001, 0.000001024"),
372+
test_mul_div => fail(r"assertion `left == right` failed: (a * b) / b != a for 0.000000001, 0.000000001
373+
left: FixedDecimal9(0)
374+
right: FixedDecimal9(1)"),
375+
test_div_mul => fail(r"assertion `left == right` failed: (a / b) * b != a for 0.000000001, 0.000001024
376+
left: FixedDecimal9(0)
377+
right: FixedDecimal9(1)"),
378378
test_mul_by_int,
379379
test_div_by_int,
380380
test_references,
@@ -386,18 +386,18 @@ mod test {
386386
FixedDecimal9,
387387
None,
388388
test_add_is_associative,
389-
test_mul_is_associative => fail(r"assertion failed: `(left == right)`
390-
left: `FixedDecimal9(0)`,
391-
right: `FixedDecimal9(1)`: (a * b) * c != a * (b * c) for 0.000000001, 0.536870912, 2.147483646"),
392-
test_mul_is_distributive => fail(r"assertion failed: `(left == right)`
393-
left: `FixedDecimal9(2)`,
394-
right: `FixedDecimal9(1)`: a * (b + c) != (a * b) + (a * c) for 0.000000001, 0.134217728, 1.879048191"),
389+
test_mul_is_associative => fail(r"assertion `left == right` failed: (a * b) * c != a * (b * c) for 0.000000001, 0.536870912, 2.147483646
390+
left: FixedDecimal9(0)
391+
right: FixedDecimal9(1)"),
392+
test_mul_is_distributive => fail(r"assertion `left == right` failed: a * (b + c) != (a * b) + (a * c) for 0.000000001, 0.134217728, 1.879048191
393+
left: FixedDecimal9(2)
394+
right: FixedDecimal9(1)"),
395395
test_mul_by_int_is_associative,
396396
test_mul_by_int_is_distributive,
397397
test_div_by_int_is_associative,
398-
test_div_by_int_is_distributive => fail(r"assertion failed: `(left == right)`
399-
left: `FixedDecimal9(1)`,
400-
right: `FixedDecimal9(0)`: (a + b) / c != (a / c) + (b / c) for 0.000000001, 0.000000001, 2"),
398+
test_div_by_int_is_distributive => fail(r"assertion `left == right` failed: (a + b) / c != (a / c) + (b / c) for 0.000000001, 0.000000001, 2
399+
left: FixedDecimal9(1)
400+
right: FixedDecimal9(0)"),
401401
test_sum,
402402
test_product,
403403
);

src/arithmetic/fixed_big.rs

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -306,9 +306,9 @@ mod test {
306306
test_is_exact,
307307
test_ceil_precision,
308308
test_ratio,
309-
test_ratio_invert => fail(r"assertion failed: `(left == right)`
310-
left: `BigFixedDecimal9(999999999)`,
311-
right: `BigFixedDecimal9(1000000000)`: R::ratio(1, a) * a != 1 for 3"),
309+
test_ratio_invert => fail(r"assertion `left == right` failed: R::ratio(1, a) * a != 1 for 3
310+
left: BigFixedDecimal9(999999999)
311+
right: BigFixedDecimal9(1000000000)"),
312312
test_is_zero,
313313
test_zero_is_add_neutral,
314314
test_add_is_commutative,
@@ -321,18 +321,18 @@ mod test {
321321
test_mul_up_is_commutative,
322322
test_mul_up_integers,
323323
test_mul_up_wrt_mul,
324-
test_invert => fail(r"assertion failed: `(left == right)`
325-
left: `BigFixedDecimal9(2147483649)`,
326-
right: `BigFixedDecimal9(2147483648)`: 1/(1/a) != a for 2.147483648"),
324+
test_invert => fail(r"assertion `left == right` failed: 1/(1/a) != a for 2.147483648
325+
left: BigFixedDecimal9(2147483649)
326+
right: BigFixedDecimal9(2147483648)"),
327327
test_div_self,
328328
test_div_up_self,
329329
test_div_up_wrt_div,
330-
test_mul_div => fail(r"assertion failed: `(left == right)`
331-
left: `BigFixedDecimal9(0)`,
332-
right: `BigFixedDecimal9(1)`: (a * b) / b != a for 0.000000001, 0.000000001"),
333-
test_div_mul => fail(r"assertion failed: `(left == right)`
334-
left: `BigFixedDecimal9(0)`,
335-
right: `BigFixedDecimal9(1)`: (a / b) * b != a for 0.000000001, 0.000001024"),
330+
test_mul_div => fail(r"assertion `left == right` failed: (a * b) / b != a for 0.000000001, 0.000000001
331+
left: BigFixedDecimal9(0)
332+
right: BigFixedDecimal9(1)"),
333+
test_div_mul => fail(r"assertion `left == right` failed: (a / b) * b != a for 0.000000001, 0.000001024
334+
left: BigFixedDecimal9(0)
335+
right: BigFixedDecimal9(1)"),
336336
test_mul_by_int,
337337
test_div_by_int,
338338
test_references,
@@ -344,18 +344,18 @@ mod test {
344344
BigFixedDecimal9,
345345
None,
346346
test_add_is_associative,
347-
test_mul_is_associative => fail(r"assertion failed: `(left == right)`
348-
left: `BigFixedDecimal9(0)`,
349-
right: `BigFixedDecimal9(1)`: (a * b) * c != a * (b * c) for 0.000000001, 0.000000001, 1152921504.606846976"),
350-
test_mul_is_distributive => fail(r"assertion failed: `(left == right)`
351-
left: `BigFixedDecimal9(281475)`,
352-
right: `BigFixedDecimal9(281474)`: a * (b + c) != (a * b) + (a * c) for 0.000000001, 0.033554432, 281474.976710656"),
347+
test_mul_is_associative => fail(r"assertion `left == right` failed: (a * b) * c != a * (b * c) for 0.000000001, 0.000000001, 1152921504.606846976
348+
left: BigFixedDecimal9(0)
349+
right: BigFixedDecimal9(1)"),
350+
test_mul_is_distributive => fail(r"assertion `left == right` failed: a * (b + c) != (a * b) + (a * c) for 0.000000001, 0.033554432, 281474.976710656
351+
left: BigFixedDecimal9(281475)
352+
right: BigFixedDecimal9(281474)"),
353353
test_mul_by_int_is_associative,
354354
test_mul_by_int_is_distributive,
355355
test_div_by_int_is_associative,
356-
test_div_by_int_is_distributive => fail(r"assertion failed: `(left == right)`
357-
left: `BigFixedDecimal9(1)`,
358-
right: `BigFixedDecimal9(0)`: (a + b) / c != (a / c) + (b / c) for 0.000000001, 0.000000001, 2"),
356+
test_div_by_int_is_distributive => fail(r"assertion `left == right` failed: (a + b) / c != (a / c) + (b / c) for 0.000000001, 0.000000001, 2
357+
left: BigFixedDecimal9(1)
358+
right: BigFixedDecimal9(0)"),
359359
test_sum,
360360
test_product,
361361
);

src/arithmetic/float64.rs

Lines changed: 39 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -94,37 +94,37 @@ mod test {
9494
test_is_exact,
9595
test_ceil_precision,
9696
test_ratio,
97-
test_ratio_invert => fail(r"assertion failed: `(left == right)`
98-
left: `0.9999999999999999`,
99-
right: `1.0`: R::ratio(1, a) * a != 1 for 49"),
97+
test_ratio_invert => fail(r"assertion `left == right` failed: R::ratio(1, a) * a != 1 for 49
98+
left: 0.9999999999999999
99+
right: 1.0"),
100100
test_is_zero,
101101
test_zero_is_add_neutral,
102102
test_add_is_commutative,
103103
test_opposite,
104104
test_sub_self,
105-
test_add_sub => fail(r"assertion failed: `(left == right)`
106-
left: `0.9999999999999999`,
107-
right: `1.0`: (a + b) - b != a for 1, 0.0000000004656613430357376"),
108-
test_sub_add => fail(r"assertion failed: `(left == right)`
109-
left: `0.0`,
110-
right: `1.1920928955078125e-7`: (a - b) + b != a for 0.00000011920928955078125, 2147483646"),
105+
test_add_sub => fail(r"assertion `left == right` failed: (a + b) - b != a for 1, 0.0000000004656613430357376
106+
left: 0.9999999999999999
107+
right: 1.0"),
108+
test_sub_add => fail(r"assertion `left == right` failed: (a - b) + b != a for 0.00000011920928955078125, 2147483646
109+
left: 0.0
110+
right: 1.1920928955078125e-7"),
111111
test_one_is_mul_neutral,
112112
test_mul_is_commutative,
113113
test_mul_up_is_commutative,
114114
test_mul_up_integers,
115115
test_mul_up_wrt_mul,
116-
test_invert => fail(r"assertion failed: `(left == right)`
117-
left: `2147483631.0000002`,
118-
right: `2147483631.0`: 1/(1/a) != a for 2147483631"),
116+
test_invert => fail(r"assertion `left == right` failed: 1/(1/a) != a for 2147483631
117+
left: 2147483631.0000002
118+
right: 2147483631.0"),
119119
test_div_self,
120120
test_div_up_self,
121121
test_div_up_wrt_div,
122-
test_mul_div => fail(r"assertion failed: `(left == right)`
123-
left: `2147483646.0000002`,
124-
right: `2147483646.0`: (a * b) / b != a for 2147483646, 0.000000000465661315280157"),
125-
test_div_mul => fail(r"assertion failed: `(left == right)`
126-
left: `0.9999999999999999`,
127-
right: `1.0`: (a / b) * b != a for 1, 2147483631"),
122+
test_mul_div => fail(r"assertion `left == right` failed: (a * b) / b != a for 2147483646, 0.000000000465661315280157
123+
left: 2147483646.0000002
124+
right: 2147483646.0"),
125+
test_div_mul => fail(r"assertion `left == right` failed: (a / b) * b != a for 1, 2147483631
126+
left: 0.9999999999999999
127+
right: 1.0"),
128128
test_mul_by_int,
129129
test_div_by_int,
130130
test_references,
@@ -135,27 +135,27 @@ mod test {
135135
f64,
136136
f64,
137137
None,
138-
test_add_is_associative => fail(r"assertion failed: `(left == right)`
139-
left: `2.0000000004656617`,
140-
right: `2.0000000004656613`: (a + b) + c != a + (b + c) for 1, 1, 0.0000000004656615095692907"),
141-
test_mul_is_associative => fail(r"assertion failed: `(left == right)`
142-
left: `9.903519996076708e27`,
143-
right: `9.903519996076707e27`: (a * b) * c != a * (b * c) for 2147483646, 2147483646, 2147483583"),
144-
test_mul_is_distributive => fail(r"assertion failed: `(left == right)`
145-
left: `4.6116857392545137e18`,
146-
right: `4.611685739254514e18`: a * (b + c) != (a * b) + (a * c) for 2147483646, 1, 2147483519"),
147-
test_mul_by_int_is_associative => fail(r"assertion failed: `(left == right)`
148-
left: `4.190951650171264e-9`,
149-
right: `4.190951650171263e-9`: (a * b) * c != a * (b * c) for 0.0000000004656612944634737, 3, 3"),
150-
test_mul_by_int_is_distributive => fail(r"assertion failed: `(left == right)`
151-
left: `3.0000000013969848`,
152-
right: `3.0000000013969843`: (a + b) * c != (a * c) + (b * c) for 1, 0.0000000004656613985469087, 3"),
153-
test_div_by_int_is_associative => fail(r"assertion failed: `(left == right)`
154-
left: `0.0303030303030303`,
155-
right: `0.030303030303030304`: (a / b) / c != a / (b * c) for 1, 3, 11"),
156-
test_div_by_int_is_distributive => fail(r"assertion failed: `(left == right)`
157-
left: `0.6`,
158-
right: `0.6000000000000001`: (a + b) / c != (a / c) + (b / c) for 1, 2, 5"),
138+
test_add_is_associative => fail(r"assertion `left == right` failed: (a + b) + c != a + (b + c) for 1, 1, 0.0000000004656615095692907
139+
left: 2.0000000004656617
140+
right: 2.0000000004656613"),
141+
test_mul_is_associative => fail(r"assertion `left == right` failed: (a * b) * c != a * (b * c) for 2147483646, 2147483646, 2147483583
142+
left: 9.903519996076708e27
143+
right: 9.903519996076707e27"),
144+
test_mul_is_distributive => fail(r"assertion `left == right` failed: a * (b + c) != (a * b) + (a * c) for 2147483646, 1, 2147483519
145+
left: 4.6116857392545137e18
146+
right: 4.611685739254514e18"),
147+
test_mul_by_int_is_associative => fail(r"assertion `left == right` failed: (a * b) * c != a * (b * c) for 0.0000000004656612944634737, 3, 3
148+
left: 4.190951650171264e-9
149+
right: 4.190951650171263e-9"),
150+
test_mul_by_int_is_distributive => fail(r"assertion `left == right` failed: (a + b) * c != (a * c) + (b * c) for 1, 0.0000000004656613985469087, 3
151+
left: 3.0000000013969848
152+
right: 3.0000000013969843"),
153+
test_div_by_int_is_associative => fail(r"assertion `left == right` failed: (a / b) / c != a / (b * c) for 1, 3, 11
154+
left: 0.0303030303030303
155+
right: 0.030303030303030304"),
156+
test_div_by_int_is_distributive => fail(r"assertion `left == right` failed: (a + b) / c != (a / c) + (b / c) for 1, 2, 5
157+
left: 0.6
158+
right: 0.6000000000000001"),
159159
test_sum,
160160
test_product,
161161
);

src/arithmetic/ratio_i64.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -52,19 +52,19 @@ mod test {
5252
i64,
5353
Ratio<i64>,
5454
None,
55-
test_add_is_associative => fail(r"assertion failed: `(left == right)`
56-
left: `Ratio { numer: -6148914815790568570, denom: 1537228657060915911 }`,
57-
right: `Ratio { numer: 4099276419306327682, denom: 512409552353638637 }`: (a + b) + c != a + (b + c) for 8, 1/2147483643, 1/2147483631"),
55+
test_add_is_associative => fail(r"assertion `left == right` failed: (a + b) + c != a + (b + c) for 8, 1/2147483643, 1/2147483631
56+
left: Ratio { numer: -6148914815790568570, denom: 1537228657060915911 }
57+
right: Ratio { numer: 4099276419306327682, denom: 512409552353638637 }"),
5858
test_mul_is_associative => fail(r"denominator == 0"),
59-
test_mul_is_distributive => fail(r"assertion failed: `(left == right)`
60-
left: `Ratio { numer: -4294967291, denom: 42949672936 }`,
61-
right: `Ratio { numer: 5, denom: 21474836468 }`: a * (b + c) != (a * b) + (a * c) for 1/4, 1/2147483646, 1/2147483645"),
59+
test_mul_is_distributive => fail(r"assertion `left == right` failed: a * (b + c) != (a * b) + (a * c) for 1/4, 1/2147483646, 1/2147483645
60+
left: Ratio { numer: -4294967291, denom: 42949672936 }
61+
right: Ratio { numer: 5, denom: 21474836468 }"),
6262
test_mul_by_int_is_associative,
6363
test_mul_by_int_is_distributive,
6464
test_div_by_int_is_associative,
65-
test_div_by_int_is_distributive => fail(r"assertion failed: `(left == right)`
66-
left: `Ratio { numer: -738197503, denom: 3026418953955049472 }`,
67-
right: `Ratio { numer: 2146451207, denom: 9079256861865148416 }`: (a + b) / c != (a / c) + (b / c) for 1/67108864, 1/2147483645, 65"),
65+
test_div_by_int_is_distributive => fail(r"assertion `left == right` failed: (a + b) / c != (a / c) + (b / c) for 1/67108864, 1/2147483645, 65
66+
left: Ratio { numer: -738197503, denom: 3026418953955049472 }
67+
right: Ratio { numer: 2146451207, denom: 9079256861865148416 }"),
6868
test_sum,
6969
test_product => fail(r"denominator == 0"),
7070
);

src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
//! implemented in the corresponding module.
1717
1818
#![forbid(missing_docs, unsafe_code)]
19-
#![cfg_attr(test, feature(test, local_key_cell_methods))]
19+
#![cfg_attr(test, feature(test))]
2020

2121
#[cfg(test)]
2222
extern crate test;

src/parse.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -239,13 +239,13 @@ mod test {
239239
}
240240

241241
#[test]
242-
#[should_panic(expected = "assertion failed: `(left == right)`\n left: `102`,\n right: `34`")]
242+
#[should_panic(expected = "assertion `left == right` failed\n left: 102\n right: 34")]
243243
fn test_remove_quotes_no_quotes() {
244244
remove_quotes("foo");
245245
}
246246

247247
#[test]
248-
#[should_panic(expected = "assertion failed: `(left == right)`\n left: `225`,\n right: `34`")]
248+
#[should_panic(expected = "assertion `left == right` failed\n left: 225\n right: 34")]
249249
fn test_remove_quotes_mid_utf8() {
250250
remove_quotes("\u{1234}foo\"");
251251
}
@@ -632,7 +632,7 @@ mod test {
632632

633633
#[test]
634634
#[should_panic(
635-
expected = "assertion failed: `(left == right)`\n left: `1`,\n right: `2`: Tie-break order must mention all candidates"
635+
expected = "assertion `left == right` failed: Tie-break order must mention all candidates\n left: 1\n right: 2"
636636
)]
637637
fn test_parse_tie_not_all_candidates() {
638638
let file = r#"2 1
@@ -663,7 +663,7 @@ mod test {
663663
}
664664

665665
#[test]
666-
#[should_panic(expected = "assertion failed: `(left == right)`\n left: `2`,\n right: `1`")]
666+
#[should_panic(expected = "assertion `left == right` failed\n left: 2\n right: 1")]
667667
fn test_parse_ballot_repeated_candidate() {
668668
let file = r#"2 1
669669
[nick apple banana]

0 commit comments

Comments
 (0)