158 Commits

Author SHA1 Message Date
David Tolnay
a28529ddc9
Skip ui test when running in miri 2021-12-11 14:50:52 -08:00
David Tolnay
7db1ea907d
Ignore needless_late_init Clippy lint
error: unneeded late initalization
       --> tests/../src/lexical/float.rs:173:9
        |
    173 |         let exp: u64;
        |         ^^^^^^^^^^^^^
        |
        = note: `-D clippy::needless-late-init` implied by `-D clippy::all`
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_late_init
    help: declare `exp` here
        |
    174 |         let exp: u64 = if (fp.exp == F::DENORMAL_EXPONENT) && (fp.mant & F::HIDDEN_BIT_MASK.as_u64()) == 0 {
        |         ++++++++++++++
    help: remove the assignments from the branches
        |
    175 ~             0
    176 |         } else {
    177 ~             (fp.exp + F::EXPONENT_BIAS) as u64
        |
    help: add a semicolon after the `if` expression
        |
    178 |         };
        |          +
2021-12-07 18:41:06 -08:00
Luca Casonato
07c740c2ff
fix parsing escape sequences after lone surrogates 2021-11-24 23:48:42 +01:00
Luca Casonato
849c6845b4
Deserialize lone surrogates into byte bufs
This commit deserializes lone surrogates in strings that are encoded in
escape sequences instead of erroring on them.
2021-11-24 14:50:33 +01:00
David Tolnay
37da27fc77
Merge pull request 822 from deankarn/master 2021-11-12 19:05:05 -08:00
Dean Karn
0992b44721 only include retain for BTreeMap if Rust 1.53.0+ 2021-11-11 21:19:51 -08:00
Dean Karn
d275e04a77 Add retain to Map
This adds the `retain` function to the Map type which calls the inner
maps, Either indexmap or std BTreeMap's, retain.

I'm trying to mutate a Value::Object's Map in-place and could't find a
nice way without the retain function.
2021-11-11 20:24:37 -08:00
David Tolnay
0035947522
Touch up PR 814 2021-11-05 12:25:12 -07:00
Timothée Haudebourg
f53ae31df6 Use the same hash for +0 and -0. 2021-11-05 12:57:41 +01:00
David Tolnay
2e1c46c895
Update ui test suite to nightly-2021-10-17 2021-10-16 19:20:52 -07:00
David Tolnay
019b179cf7
Ui test changes for trybuild 1.0.49 2021-10-08 03:00:04 -04:00
David Tolnay
733b353394
Update ui test files 2021-10-07 00:19:07 -04:00
David Tolnay
9298f54ace
Resolve manual_str_repeat clippy lint 2021-10-01 01:11:06 -04:00
David Tolnay
019041e4d5
Resolve semicolon_if_nothing_returned pedantic clippy lint
error: consider adding a `;` to the last statement for consistent formatting
       --> tests/../src/lexical/float.rs:111:9
        |
    111 |         round_to_native::<F, _>(self, algorithm)
        |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: add a `;` here: `round_to_native::<F, _>(self, algorithm);`
        |
        = note: `-D clippy::semicolon-if-nothing-returned` implied by `-D clippy::pedantic`
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#semicolon_if_nothing_returned

    error: consider adding a `;` to the last statement for consistent formatting
       --> tests/../src/lexical/math.rs:616:9
        |
    616 |         iadd_impl(x, y, 0)
        |         ^^^^^^^^^^^^^^^^^^ help: add a `;` here: `iadd_impl(x, y, 0);`
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#semicolon_if_nothing_returned

    error: consider adding a `;` to the last statement for consistent formatting
       --> tests/../src/lexical/math.rs:862:9
        |
    862 |         self.ishl(n as usize)
        |         ^^^^^^^^^^^^^^^^^^^^^ help: add a `;` here: `self.ishl(n as usize);`
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#semicolon_if_nothing_returned

    error: consider adding a `;` to the last statement for consistent formatting
       --> tests/../src/lexical/math.rs:868:9
        |
    868 |         small::imul_pow5(self.data_mut(), n)
        |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: add a `;` here: `small::imul_pow5(self.data_mut(), n);`
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#semicolon_if_nothing_returned

    error: consider adding a `;` to the last statement for consistent formatting
       --> tests/lexical/float.rs:184:5
        |
    184 |     check_round_to_f64(10234494226754558294, -1086, 2498655817078750, -1074)
        |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: add a `;` here: `check_round_to_f64(10234494226754558294, -1086, 2498655817078750, -1074);`
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#semicolon_if_nothing_returned
2021-10-01 01:09:12 -04:00
David Tolnay
0b5931550a
Resolve needless_borrow clippy lint
error: this expression borrows a reference (`&lexical::float::ExtendedFloat`) that is immediately dereferenced by the compiler
       --> tests/../src/lexical/algorithm.rs:136:45
        |
    136 |         u64::error_is_accurate::<F>(errors, &fp)
        |                                             ^^^ help: change this to: `fp`
        |
        = note: `-D clippy::needless-borrow` implied by `-D clippy::all`
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
2021-10-01 01:07:42 -04:00
David Tolnay
fc4db0306a
Run clippy on test suite too 2021-10-01 00:46:45 -04:00
David Tolnay
f5219be867
Add test parsing -0 2021-09-14 12:52:55 -07:00
David Tolnay
b419f2e065
Test negative zero parsing to f32 2021-09-14 12:51:27 -07:00
David Tolnay
ef823af7d5
Suppress unused field in test_borrow_in_map_key
warning: field is never read: `map`
        --> tests/test.rs:2233:9
         |
    2233 |         map: BTreeMap<MyMapKey, ()>,
         |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^
         |
         = note: `#[warn(dead_code)]` on by default
2021-09-14 12:50:03 -07:00
David Tolnay
f4fc150c45
Fix dead code warning in issue 795 regression test
warning: field is never read: `x`
     --> tests/regression/issue795.rs:9:15
      |
    9 |     Variant { x: u8 },
      |               ^^^^^
      |
      = note: `#[warn(dead_code)]` on by default
2021-09-14 12:49:18 -07:00
David Tolnay
12207ed2a3
Add regression test for issue 795 2021-08-28 11:21:40 -07:00
Ruifeng Xie
21523246e5
Make arbitrary_precision preserve the exact string representation 2021-07-17 11:27:27 +08:00
David Tolnay
892e2a8264
Update ui test suite to nightly-2021-05-14 2021-05-13 19:15:50 -07:00
David Tolnay
2f812d0363
Add test of RawValue deserialization from invalid utf-8 2021-02-27 20:46:09 -08:00
David Tolnay
9bcb08fd92
Fix unnecessary trailing semicolon lints in test suite
warning: unnecessary trailing semicolon
        --> tests/test.rs:2133:6
         |
    2133 |     };
         |      ^ help: remove this semicolon
         |
         = note: `#[warn(redundant_semicolons)]` on by default

    warning: unnecessary trailing semicolon
        --> tests/test.rs:2166:6
         |
    2166 |     };
         |      ^ help: remove this semicolon
2021-02-27 20:44:53 -08:00
David Tolnay
b1ca6c7186
Add test of as_f64 on large number
Closes https://github.com/serde-rs/json/issues/710.
2020-10-12 13:35:04 -07:00
David Tolnay
509d52e70a
Simplify how regression tests are imported 2020-09-05 12:33:03 -07:00
David Tolnay
9357569b1c
Trigger missing comma rustc suggestion 2020-06-28 22:46:33 -07:00
David Tolnay
0443daa488
Prevent type ascription misdiagnosis 2020-06-28 22:38:59 -07:00
David Tolnay
4a948df6f6
Add ui test of missing comma between object entries 2020-06-28 22:24:56 -07:00
David Tolnay
43598d82f4
Gate some tests behind float_roundtrip feature 2020-06-08 21:36:27 -07:00
David Tolnay
5cb2721d5f
Add float test case demonstrating exponent overflow
thread 'test_parse_f64' panicked at 'attempt to subtract with overflow', src/de.rs:664:27
2020-06-07 23:46:40 -07:00
David Tolnay
67f3dc37dc
Format with rustfmt 2020-05-19 2020-06-07 19:53:49 -07:00
David Tolnay
24fae937ea
Deduplicate significand computation 2020-06-07 19:38:57 -07:00
David Tolnay
f0cbff81d4
Print both values on failure in lexical parse test 2020-06-07 19:21:38 -07:00
David Tolnay
ddf5f17a38
Add brief note to top of lexical sources 2020-06-07 15:20:24 -07:00
David Tolnay
3a9d27a729
Add some more number failure tests 2020-06-07 13:05:42 -07:00
David Tolnay
b1be95723e
Add roundtrip test of f32 edge case 2020-06-07 12:11:14 -07:00
David Tolnay
f753b96ddd
Ignore some clippy lints in lexical tests 2020-06-07 01:33:30 -07:00
David Tolnay
fd7168fa8e
Resolve redundant_field_names lint 2020-06-07 01:30:54 -07:00
David Tolnay
214c9ea201
Remove i32 num impls 2020-06-07 01:20:38 -07:00
David Tolnay
758d6789bd
Remove unused supertraits in lexical num library 2020-06-07 01:03:08 -07:00
David Tolnay
51392b8bf5
Remove test of removed num types 2020-06-07 00:57:01 -07:00
David Tolnay
db60f98bc3
Touch up new float roundtrip test from PR 671 2020-06-07 00:21:30 -07:00
David Tolnay
9091105d98
Remove gratuitous inline from lexical test 2020-06-07 00:10:44 -07:00
David Tolnay
7d084b2c48
Remove dead lexical test code involving radix 2020-06-07 00:10:43 -07:00
David Tolnay
664cd2d253
Move lexical unit tests to tests directory 2020-06-07 00:10:43 -07:00
David Tolnay
adafa9350c
Merge pull request #671 from japaric/gh536
tweak f64 deserialization to make float roundtrips work
2020-06-07 00:08:03 -07:00
David Tolnay
39c9499688
Format with rustfmt 2020-05-19 2020-06-06 00:03:10 -07:00
David Tolnay
e943bec750
Deal with clippy lints in tests
$ cargo clippy --tests
2020-06-06 00:01:53 -07:00