Commit graph

33 commits

Author SHA1 Message Date
Alan Du 87f51b38d1 Error when trying to serialize invalid float 2017-05-31 00:30:58 +01:00
Alan Du 90040b34b6 Error when parsing numbers outside of f64's range 2017-05-31 00:30:55 +01:00
Vincent Prouillet 7cb357c168 Allow to deserialize/serialize into enums
Close #164
2017-04-24 22:13:38 +09:00
Alex Crichton dc5ff1ef90 Support serde 1.0.0 2017-04-20 10:16:00 -07:00
Daniel Lockyer 3034a7cf52 Simplify if-statements 2017-04-12 09:28:56 +01:00
Alex Crichton 5152f3aca0 Fix backcompat with array definitions 2017-03-31 18:45:00 -07:00
Alex Crichton b6178aed2a Relax assertions in substr_offset slightly
Closes #152
2017-02-21 20:27:43 -08:00
Evgenii Pashkin ded040ae9e Fixed sorting of table values 2017-02-19 18:15:58 +03:00
Alex Crichton 2fd12e72d8 Fix displaying empty arrays
Closes #145
2017-02-11 09:13:33 -08:00
Alex Crichton 67fb9f1953 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 d02c02d995 Implement Deserializer::set_require_newline_after_table 2017-02-08 21:36:38 -08:00
Alex Crichton e256931e9b 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 1e575d420c 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
Alex Crichton 41563ee01b wip 2015-04-02 17:12:37 -07:00
Alex Crichton c8a5ca4ece Bump to 0.1.19 2015-03-25 10:11:05 -07:00
Alex Crichton ff3bb7d255 Reduce usage of unstable features 2015-03-09 11:09:07 -07:00
Alex Crichton 39ffe7a449 Add v0.4.0 compliance test 2015-02-13 18:31:04 -08:00
Alex Crichton b3e9653b7f Properly escape keys when printing TOML
Closes #53
2015-02-02 22:54:46 -08:00
Alex Crichton 482752b5f4 Migrate to as many stable functions as possible 2015-01-27 19:29:58 -08:00
Alex Crichton 31d99cd425 Remove slash as an escapeable character 2015-01-20 10:00:43 -08:00
Alex Crichton 3536cb50e6 Update key syntax to TOML master
* Bare keys contain a very limited set of characters now.
* Keys in quotes behave the same as basic strings.

Closes #47
2015-01-15 19:47:56 -08:00
Alex Crichton 0285af245a Implement new rules for bare key names
* Key names are restricted to [a-zA-Z0-9_-]
* Equal signs must be on the same line (as must the next value) as the key
* Quoted keys are allowed and are parsed as basic strings.

Closes #48
2015-01-15 17:34:27 -08:00
Alex Crichton 9dd46d6fbf Fix parsing leading + on numbers 2015-01-15 14:27:55 -08:00
Alex Crichton 931114a13c Add a few more tests from the toml-lang repo 2015-01-15 12:56:35 -08:00
Alex Crichton 0d8ce979a4 Move tests to integration tests 2015-01-15 12:44:05 -08:00