Commit Graph

62 Commits (master)

Author SHA1 Message Date
James Kay 95d419ba99 Nested dotted-table enums (#329)
Add support for deserializing enums from nested dotted tables.
2019-09-05 09:18:26 -05:00
Azriel Hoh df7ec3a4b6 Maintain backward compatibility with Rust 1.15, take 3. 2018-11-17 14:19:14 +13:00
Azriel Hoh 2907bd1953 Error when deserializing struct if encountering unknown fields.
Issue #225
2018-11-12 10:09:30 +13:00
Azriel Hoh 2c2d629812 Added ignored tests for deserializing enums from dotted table.
Issue #225
2018-11-12 09:00:47 +13:00
Azriel Hoh fcc4a58617 Implemented deserialization for external enums.
Issue #225
2018-11-10 11:10:31 +13:00
David Tolnay 3ad6e71f53
Move tests into their own crate 2017-11-12 19:33:11 -08:00
Alex Crichton 9e53679093 Fix a number of compile warnings 2017-08-28 07:40:48 -07:00
Garrett Berg d17c881c09 close #209: remove FIXME, appears to have been invalid 2017-08-13 17:34:36 -06:00
Garrett Berg eaa0c17220 add pretty_string_literal to be able to disable literal strings 2017-08-13 17:19:02 -06:00
Garrett Berg a0d0a313df add spaces between array items and test for them 2017-08-13 15:31:09 -06:00
Garrett Berg ca81a4a291 add """ for non-literals with newlines, clean up logic and add tests 2017-07-28 09:25:53 -06:00
Garrett Berg a29c1eeef0 make single lines also pretty 2017-07-28 07:14:37 -06:00
Garrett Berg 9548288de5 fix bugs with pretty 2017-07-27 22:01:36 -06:00
Garrett Berg 219de2dd4d close #199: add header information for empty structs
- also add test which fails without this change
- also add a few helpful unit tests to table
2017-07-27 07:03:52 -06:00
Garrett Berg 766b27e902 fix Serializer::pretty_array(false) 2017-07-24 09:46:24 -06:00
Garrett Berg 11e2baa1d4 add tests 2017-07-24 09:40:14 -06:00
Garrett Berg ef8af0e52a fix for rust 1.15 2017-07-10 09:45:59 -06:00
Garrett Berg ae6096ab26 pretty arrays 2017-07-09 15:20:29 -06:00
Garrett Berg ffdafc4d36 array doesn't break anything... 2017-07-09 15:10:36 -06:00
Garrett Berg 391cb61dff add pretty sting serialization 2017-07-09 14:58:48 -06:00
Alex Crichton f6673dfdb3 One more case of handling newtype structs 2017-07-06 11:43:36 -07:00
Alex Crichton ad5bd8758e Support deserializing newtypes
Closes #196
2017-07-06 07:34:45 -07:00
Alan Du 2dfc9fedd3 Store fractional seconds as a u32 instead of a f64
Drops precision down to the nanoseconds
2017-06-01 23:22:35 +01:00
Alan Du 69576569a7 Allow serializing keys with \n in them
Use special quoted form

Closes https://github.com/alexcrichton/toml-rs/issues/185
2017-06-01 20:59:26 +01:00
Alan Du dc407a6833 Truncate fractional seconds to picoseconds
Close https://github.com/alexcrichton/toml-rs/issues/186
2017-06-01 20:57:06 +01:00
Alan Du 20dced6967 Add test case 2017-06-01 12:42:16 +01:00
Alan Du 71b5310234 Remove unused test macro 2017-05-31 17:36:20 +01:00
Alex Crichton 95e1c73846 Merge pull request #183 from alanhdu/invalid_number
Better invalid number handling
2017-05-30 19:37:44 -05:00
Alan Du 2a6b365f7c Error when trying to serialize invalid float 2017-05-31 00:30:58 +01:00
Alan Du 3322bcd086 Error when parsing numbers outside of f64's range 2017-05-31 00:30:55 +01:00
Alan Du f98d6ccd70 Encode control characters with hex not decimal
Fix https://github.com/alexcrichton/toml-rs/issues/178
2017-05-30 23:55:09 +01:00
Vincent Prouillet 099d7b6683 Allow to deserialize/serialize into enums
Close #164
2017-04-24 22:13:38 +09:00
Alex Crichton 0cc6dc9960 Support serde 1.0.0 2017-04-20 10:16:00 -07:00
Daniel Lockyer a2053c8505 Simplify if-statements 2017-04-12 09:28:56 +01:00
Alex Crichton 827a7c960c Fix backcompat with array definitions 2017-03-31 18:45:00 -07:00
Alex Crichton d39c3f7b3e Relax assertions in substr_offset slightly
Closes #152
2017-02-21 20:27:43 -08:00
Evgenii Pashkin 2e71aaf8f6 Fixed sorting of table values 2017-02-19 18:15:58 +03:00
Alex Crichton fba7778782 Fix displaying empty arrays
Closes #145
2017-02-11 09:13:33 -08:00
Alex Crichton 79fc6c3fcb Add a serialization helper to put tables last
This should help serializing maps where it's unknown up front whether the tables
and/or values come first.

Closes #142
2017-02-10 15:29:36 -08:00
Alex Crichton 204d1b14e6 Implement Deserializer::set_require_newline_after_table 2017-02-08 21:36:38 -08:00
Alex Crichton f66d8bcf33 Rewrite crate with serde support from ground up
This commit completely rewrites this crate from the ground up,
supporting serde at the lowest levels as I believe serde support was
intended to do. This is a major change from the previous versions of
this crate, with a summary of changes being:

* Serialization directly to TOML is now supported without going through
  a `Value` first.

* Deserialization directly from TOML is now supported without going
  through a `Value`. Note that due to the TOML format some values still
  are buffered in intermediate memory, but overall this should be at a
  minimum now.

* The API of `Value` was overhauled to match the API of
  `serde_json::Value`. The changes here were to:

  * Add `is_*` accessors
  * Add `get` and `get_mut` for one-field lookups.
  * Implement panicking lookups through `Index`

  The old `index` methods are now gone in favor of `get` and `Index`
  implementations.

* A `Datetime` type has been added to represent a TOML datetime in a
  first-class fashion. Currently this type provides no accessors other
  than a `Display` implementation, but the idea is that this will grow
  support over time for decomposing the date.

* Support for the `rustc-serialize` crate has been dropped, that'll stay
  on the 0.2 and 0.1 release trains.

* This crate no longer supports the detection of unused fields, for that though
  you can use the `serde_ignored` crate on crates.io
2017-02-08 21:21:18 -08:00
nabijaczleweli 89384b1e0c
Add tests for checking for extraneous leading newlines (or lack thereof)
Couldn't find a better place to put this (the "valid" and "invalid"
tests are just for parser) so I made a new test module
2016-09-06 21:16:21 +02:00
James Sanderson 2cd1116e06 Add failing test cases containing invalid Toml with keys on the same line as table definition 2016-04-17 22:51:28 +01:00
Tae-il Lim 8dbc107441 Tweak unicode-escape test 2016-04-03 17:08:23 +09:00
Tae-il Lim 8a207a83fe Update integration tests to BurntSushi/toml-test@2f1c20de60 2016-04-02 17:15:59 +09:00
osboxes.org dea8646b8b Allow BOM (Byte order mark) in toml 2015-10-07 11:35:49 +02:00
Alex Gulyás 0f0746396a Add a very simple test for Parser::to_linecol.
This test shows that in some cases converting error offsets generated by
the parser to line and column numbers will panic ('arithmetic operation
overflowed') in debug mode, and return an incorrect column number in
release mode.
2015-08-14 14:39:59 +02:00
Alex Crichton f011b01051 Make serde-tests a standalone crate 2015-08-13 09:39:49 -07:00
Erick Tryzelaar bbc167cde9 Get serde feature compiling again 2015-08-12 23:01:49 -07:00
Oliver Schneider 6e2f2c39e4 most tests work now 2015-04-20 15:11:34 +02:00