78 Commits

Author SHA1 Message Date
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
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
9298f54ace
Resolve manual_str_repeat clippy lint 2021-10-01 01:11:06 -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
Ruifeng Xie
21523246e5
Make arbitrary_precision preserve the exact string representation 2021-07-17 11:27:27 +08: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
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
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
db60f98bc3
Touch up new float roundtrip test from PR 671 2020-06-07 00:21:30 -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
Jorge Aparicio
cfd0a317fd add sample roundtrip test 2020-05-13 17:59:29 +02:00
Jean-Marc Fiaschi
0b43936690 remplace serialize key,value functions by serialize_entry
call serialize_key/value into serialize_entry
2020-02-02 17:25:24 +01:00
David Tolnay
7cf0156d47
Switch to tool attrs 2020-01-22 14:03:12 -08:00
David Tolnay
17d9a5ea9b
Organize imports 2020-01-22 13:53:35 -08:00
David Tolnay
3040daa1c6
Update tests to 2018 edition 2020-01-22 13:45:47 -08:00
Erick Tryzelaar
4ae13a5393 Implement IntoDeserializer for Value
This allows users to deserialize from types like `HashMap<String, Value>`.
2019-12-04 10:41:10 -08:00
David Tolnay
5bc17fa49a
Remove try! macro from tests 2019-10-02 21:13:55 -04:00
Yorhel
69bfbfc71f Return EOF error on cut-off negative sign or exponent 2019-03-19 10:10:34 +01:00
Yorhel
367a1de69e Return EOF error on cut-off decimal number
Fixes #524
2019-03-18 14:08:13 +01:00
David Tolnay
dc6edcbadd
Merge pull request #509 from dtolnay/stacker
Unbounded depth
2019-01-31 18:20:01 -08:00
David Tolnay
7e4427c781
Quotes around u128 in map key 2019-01-16 13:55:52 -08:00
David Tolnay
1168aedc4d
More sensitive test for recursion error
If eat_char is moved before the recursion check, the original test will
continue to pass but the new test will catch it.
2019-01-14 10:11:29 -08:00
David Tolnay
df1a227cc7
Unbounded depth 2019-01-13 11:27:04 -08:00
David Tolnay
4d5234c8d9
Copyright/license headers
The following changes are included:

- Delete per-file license notices at the top of each file.
- Delete the first paragraph of LICENSE-MIT (an inaccurate
  pseudo-copyright line), leaving only the text of the MIT license.

Nothing about the license of Serde code has changed, only our
understanding of how to correctly communicate the license has changed.

This mirrors an equivalent change being applied in the rust-lang/rust
repository.
2019-01-12 15:14:56 -08:00
David Tolnay
8304704f76
Update name of deprecated str::trim_right 2018-12-30 22:35:07 -05:00
koushiro
f3c641c228 Modify test
Signed-off-by: koushiro <koushiro.cqx@gmail.com>
2018-12-29 17:14:04 +08:00
koushiro
f69e1ffe3f Fix serialization of i128 and u128 types
Signed-off-by: koushiro <koushiro.cqx@gmail.com>
2018-12-29 17:08:02 +08:00
David Tolnay
bcad4a9460
Allow map key to be borrowed from &Value 2018-11-09 09:13:51 -08:00
David Tolnay
b3001f48ee
Format with rustfmt 0.99.6-nightly 2018-11-06 14:22:39 -08:00
David Tolnay
2161f0540f
Fix overflow on i32::min_value() as exponent 2018-10-03 22:23:48 -07:00
Jihyun Yu
ab670b4e9f fix bug on error position 2018-09-29 15:39:58 +09:00
David Tolnay
a45b5c592a
Fix malicious arbitrary precision number test 2018-09-20 10:48:48 -07:00
David Tolnay
82abb08f90
Use Box<RawValue> as the owned raw value 2018-09-20 01:34:12 -07:00
David Tolnay
9c60f196f2
Split RawSlice and RawValue 2018-09-19 23:01:26 -07:00
David Tolnay
f96b59d6b3
Cfg gate everything having to do with RawValue 2018-09-17 08:11:00 -07:00
Sam Rijs
6d38232a2c Implement RawValue type
fixes #355
2018-09-14 20:11:44 +10:00
David Tolnay
5c931e0536
Make json macro compatible with deny(unused_results)
The unused_results lint triggers on any function call returning anything
other than () or ! that is not used. The Map::insert function returns
Option<Value> of the previous value of the inserted key.
2018-07-16 09:35:44 -07:00
David Tolnay
1b36cec484
Format with rustfmt 0.8.2 2018-07-08 19:01:20 -07:00
David Tolnay
22046a50dc
Produce eof error on truncated ident 2018-06-24 16:31:12 -07:00