Commit Graph

262 Commits

Author SHA1 Message Date
Johannes Willbold
414fd694c0 Allowed serde(tag="...") on structs
Added test test_internally_tagged_struct
Renamed EnumTag to TagType as it now also used for structs 
Modified serialize_struct_as_struct
2018-12-27 20:18:36 +01:00
David Tolnay
16daba8ea9
Format with rustfmt 2018-11-30 2018-12-10 22:09:34 -08:00
David Tolnay
8b4074ee77
Tests for tuple default attribute 2018-12-10 22:09:33 -08:00
hcpl
14a3da9b16 Improve UI test coverage
With this commit I believe I've covered all `compile_error!`-based
errors.
2018-11-30 03:07:31 +02:00
hcpl
034db9f20f Improve overall quality of compile_error! errors
Also updates UI tests.
2018-11-30 02:51:49 +02:00
David Tolnay
58b3af4c29
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 that license has changed.

This mirrors an equivalent change being applied in the rust-lang/rust
repository.
2018-11-24 15:53:09 -08:00
David Tolnay
4821d09a48
Move all compile-fail tests to ui tests
The update-references.sh script makes these much easier to update in
bulk compared to compile-fail tests.
2018-11-24 15:43:19 -08:00
David Tolnay
b3d9d51b51
Simplify compiletest setup 2018-11-24 15:35:49 -08:00
David Tolnay
9afc5fef11
Format with rustfmt 1.0.0-nightly 2018-11-21 01:13:17 -08:00
David Tolnay
a51f831ae4
Drop nightly dependency of compiletest 2018-10-27 23:59:48 -07:00
David Tolnay
778e516270
Feature panic_handler has been stabilized 2018-10-06 21:12:14 -07:00
David Tolnay
f1e8dcf38e
Run test suite on asmjs 2018-09-15 15:25:55 -07:00
David Tolnay
23a53d8008
Remove unused proc-macro2 dependency in test suite 2018-09-15 15:12:47 -07:00
David Tolnay
66a9ccb10e
Ignore renamed_and_removed_lints lint
The recommended replacement involving clippy::all has not been
stabilized yet.
2018-09-11 23:05:33 -07:00
David Tolnay
53fe1b328e
Format with rustfmt 0.99.4 2018-09-11 23:00:08 -07:00
roblabla
0156f1355a Remove obsolete compile-fail test 2018-09-10 17:15:22 +00:00
roblabla
7870b58356 Add tests for serde(other) in enum 2018-09-10 16:25:02 +00:00
David Tolnay
2a4b8ce42d
Fix panic deserializing flattened any after flattened struct 2018-09-08 16:55:34 -07:00
David Reid
389b9b5fe7 Add a test for an internally tagged unit enum flattened with a second internally tagged unit enum. 2018-09-06 14:55:10 -07:00
David Reid
27478b6f71 Internally tagged unit enum variants should ignore unknown fields. 2018-09-06 14:29:49 -07:00
David Tolnay
480f858fc3
Update panic_handler attribute name changed in nightly 2018-09-03 08:24:27 -07:00
David Tolnay
d0464fbff7
Add Emscripten build in Travis 2018-09-02 12:34:13 -07:00
David Tolnay
d23a40c1bb
Format with rustfmt 0.99.2 2018-09-01 23:03:41 -07:00
David Tolnay
5b7b8abf9f
Move some compile-fail errors based on proc-macro2 update 2018-08-28 20:35:49 -07:00
David Tolnay
1175d54fb7
Stabilize raw_identifiers 2018-08-24 19:49:13 -04:00
David Tolnay
a3ae14d090
Test raw identifiers 2018-08-22 21:09:37 -04:00
David Tolnay
5985b7edaf
Format with rustfmt 0.99.2 2018-08-14 19:59:20 -07:00
David Tolnay
d28a0e66c8
Fix old reference to serde_codegen 2018-08-12 10:54:59 -07:00
David Tolnay
0ca4db1616
Move untagged borrow test case into codegen tests 2018-08-12 10:54:29 -07:00
David Tolnay
72b3438dfc
Merge pull request #1338 from toidiu/ak-untagged-enum
test borrowing untagged enum
2018-08-12 10:49:15 -07:00
David Tolnay
e26960f7f8
Remove useless run-pass test
When originally added, this test used to contain a `#![plugin(clippy)]`.
This was removed at some point along the way, at which point this test
no longer tests anything. It prints:

    warning: unknown lint: `identity_op`
     --> src/main.rs:1:9
      |
    1 | #![deny(identity_op)]
      |         ^^^^^^^^^^^
      |
      = note: #[warn(unknown_lints)] on by default

which is swallowed and ignored by compiletest.

Nowadays Clippy handles warnings inside of macro expanded code
intelligently and this is something they would be responsible for
testing.
2018-08-06 22:57:46 -07:00
David Tolnay
28db9d4989
Format with rustfmt 0.99.1 2018-08-06 22:40:28 -07:00
Caio
8b2e6baf78 Implement Serialize and Deserialize for RangeInclusive 2018-08-05 10:45:50 -03:00
toidiu
3ca0597a7e test borrowing untagged enum 2018-07-12 17:12:27 -04:00
David Tolnay
4e54aaf796
Format with rustfmt 0.8.2 2018-07-08 19:02:44 -07:00
David Tolnay
84e384196d
Implement Serialize for core::fmt::Arguments 2018-06-26 23:58:16 -07:00
David Tolnay
a1280c672a
Switch no-std panic to #[panic_implementation] 2018-06-04 10:13:29 -07:00
David Tolnay
a740f76772
Update no-std panic signature for nightly-2018-06-03 2018-06-03 23:15:16 -07:00
David Tolnay
94853752a1
Stabilize some unstable tests in test suite 2018-06-03 00:31:20 -07:00
David Tolnay
22b1af7eb3
Test never_type 2018-06-03 00:22:11 -07:00
David Tolnay
0a71fe329c
Format the compile-test sources with rustfmt 0.8.2 2018-06-02 22:30:55 -07:00
David Tolnay
a4acc83282
Place compile-fail expected errors on their own line 2018-06-02 22:28:05 -07:00
David Tolnay
7ad3d17e59
Merge pull request #1297 from adamcrume/master
Use compile_error! instead of panicking
2018-06-02 22:00:24 -07:00
Adam Crume
05e931b9a5 Update tests and use quote! macro 2018-06-02 21:11:42 -07:00
David Tolnay
d5ec3efe49
Merge pull request #1299 from dtolnay/flattenmap
Allow multiple flattened maps to see the same fields
2018-06-01 13:00:45 -07:00
David Tolnay
5ee2fc0562
Allow multiple flattened maps to see the same fields
Before this change, flattening anything after a flattened map was
nonsensical because the later flattened field would always observe no
input fields.

    #[derive(Deserialize)]
    struct S {
        #[serde(flatten)]
        map: Map<K, V>,
        #[serde(flatten)]
        other: Other, // always empty
    }

This change makes a flattened map not consume any of the input fields,
leaving them available to later flattened fields in the same struct. The
new behavior is useful when two flattened fields that both use
deserialize_map care about disjoint subsets of the fields in the input.

    #[derive(Deserialize)]
    struct S {
        // Looks at fields with a "player1_" prefix.
        #[serde(flatten, with = "prefix_player1")]
        player1: Player,
        // Looks at fields with a "player2_" prefix.
        #[serde(flatten, with = "prefix_player2")]
        player2: Player,
    }
2018-06-01 12:50:23 -07:00
Konrad Borowski
c3b9ee314b Use try_borrow for serializing RefCell 2018-06-01 09:09:40 +02:00
David Tolnay
927ec7d38e
Implement Copy for value deserializers of primitive types 2018-05-26 15:56:57 -07:00
David Tolnay
ea118e11a0
Test the 128-bit IntoDeserializer impls 2018-05-26 15:21:37 -07:00
David Tolnay
b279ebb244
Merge pull request #1263 from serde-rs/integer128
Add Serde impls for i128 and u128
2018-05-25 16:03:08 -07:00