commit
7e11e364f3
|
@ -81,7 +81,7 @@ impl<'a> Parser<'a> {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn next_pos(&self) -> uint {
|
fn next_pos(&self) -> uint {
|
||||||
self.cur.clone().next().map(|p| p.val0()).unwrap_or(self.input.len())
|
self.cur.clone().next().map(|p| p.0).unwrap_or(self.input.len())
|
||||||
}
|
}
|
||||||
|
|
||||||
// Returns true and consumes the next character if it matches `ch`,
|
// Returns true and consumes the next character if it matches `ch`,
|
||||||
|
@ -96,8 +96,8 @@ impl<'a> Parser<'a> {
|
||||||
fn expect(&mut self, ch: char) -> bool {
|
fn expect(&mut self, ch: char) -> bool {
|
||||||
if self.eat(ch) { return true }
|
if self.eat(ch) { return true }
|
||||||
let mut it = self.cur.clone();
|
let mut it = self.cur.clone();
|
||||||
let lo = it.next().map(|p| p.val0()).unwrap_or(self.input.len());
|
let lo = it.next().map(|p| p.0).unwrap_or(self.input.len());
|
||||||
let hi = it.next().map(|p| p.val0()).unwrap_or(self.input.len());
|
let hi = it.next().map(|p| p.0).unwrap_or(self.input.len());
|
||||||
self.errors.push(ParserError {
|
self.errors.push(ParserError {
|
||||||
lo: lo,
|
lo: lo,
|
||||||
hi: hi,
|
hi: hi,
|
||||||
|
@ -258,8 +258,8 @@ impl<'a> Parser<'a> {
|
||||||
Some((pos, ch)) if ch.is_digit(10) => self.number_or_datetime(pos),
|
Some((pos, ch)) if ch.is_digit(10) => self.number_or_datetime(pos),
|
||||||
_ => {
|
_ => {
|
||||||
let mut it = self.cur.clone();
|
let mut it = self.cur.clone();
|
||||||
let lo = it.next().map(|p| p.val0()).unwrap_or(self.input.len());
|
let lo = it.next().map(|p| p.0).unwrap_or(self.input.len());
|
||||||
let hi = it.next().map(|p| p.val0()).unwrap_or(self.input.len());
|
let hi = it.next().map(|p| p.0).unwrap_or(self.input.len());
|
||||||
self.errors.push(ParserError {
|
self.errors.push(ParserError {
|
||||||
lo: lo,
|
lo: lo,
|
||||||
hi: hi,
|
hi: hi,
|
||||||
|
@ -624,8 +624,8 @@ impl<'a> Parser<'a> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn recurse<'a>(&mut self, mut cur: &'a mut TomlTable, orig_key: &'a str,
|
fn recurse<'b>(&mut self, mut cur: &'b mut TomlTable, orig_key: &'b str,
|
||||||
key_lo: uint) -> Option<(&'a mut TomlTable, &'a str)> {
|
key_lo: uint) -> Option<(&'b mut TomlTable, &'b str)> {
|
||||||
if orig_key.starts_with(".") || orig_key.ends_with(".") ||
|
if orig_key.starts_with(".") || orig_key.ends_with(".") ||
|
||||||
orig_key.contains("..") {
|
orig_key.contains("..") {
|
||||||
self.errors.push(ParserError {
|
self.errors.push(ParserError {
|
||||||
|
|
|
@ -204,37 +204,45 @@ impl serialize::Encoder<Error> for Encoder {
|
||||||
fn emit_str(&mut self, v: &str) -> Result<(), Error> {
|
fn emit_str(&mut self, v: &str) -> Result<(), Error> {
|
||||||
self.emit_value(Value::String(v.to_string()))
|
self.emit_value(Value::String(v.to_string()))
|
||||||
}
|
}
|
||||||
fn emit_enum(&mut self, _name: &str,
|
fn emit_enum<F>(&mut self, _name: &str, f: F)
|
||||||
f: |&mut Encoder| -> Result<(), Error>) -> Result<(), Error> {
|
|
||||||
f(self)
|
|
||||||
}
|
|
||||||
fn emit_enum_variant(&mut self, _v_name: &str, _v_id: uint, _len: uint,
|
|
||||||
f: |&mut Encoder| -> Result<(), Error>)
|
|
||||||
-> Result<(), Error>
|
-> Result<(), Error>
|
||||||
|
where F: FnOnce(&mut Encoder) -> Result<(), Error>
|
||||||
{
|
{
|
||||||
f(self)
|
f(self)
|
||||||
}
|
}
|
||||||
fn emit_enum_variant_arg(&mut self, _a_idx: uint,
|
fn emit_enum_variant<F>(&mut self, _v_name: &str, _v_id: uint, _len: uint, f: F)
|
||||||
f: |&mut Encoder| -> Result<(), Error>)
|
|
||||||
-> Result<(), Error>
|
-> Result<(), Error>
|
||||||
|
where F: FnOnce(&mut Encoder) -> Result<(), Error>
|
||||||
{
|
{
|
||||||
f(self)
|
f(self)
|
||||||
}
|
}
|
||||||
fn emit_enum_struct_variant(&mut self, _v_name: &str, _v_id: uint,
|
fn emit_enum_variant_arg<F>(&mut self, _a_idx: uint, f: F)
|
||||||
_len: uint,
|
|
||||||
_f: |&mut Encoder| -> Result<(), Error>)
|
|
||||||
-> Result<(), Error>
|
-> Result<(), Error>
|
||||||
|
where F: FnOnce(&mut Encoder) -> Result<(), Error>
|
||||||
|
{
|
||||||
|
f(self)
|
||||||
|
}
|
||||||
|
fn emit_enum_struct_variant<F>(&mut self, _v_name: &str, _v_id: uint,
|
||||||
|
_len: uint,
|
||||||
|
_f: F)
|
||||||
|
-> Result<(), Error>
|
||||||
|
where F: FnOnce(&mut Encoder) -> Result<(), Error>
|
||||||
{
|
{
|
||||||
panic!()
|
panic!()
|
||||||
}
|
}
|
||||||
fn emit_enum_struct_variant_field(&mut self, _f_name: &str, _f_idx: uint,
|
fn emit_enum_struct_variant_field<F>(&mut self,
|
||||||
_f: |&mut Encoder| -> Result<(), Error>)
|
_f_name: &str,
|
||||||
|
_f_idx: uint,
|
||||||
|
_f: F)
|
||||||
-> Result<(), Error>
|
-> Result<(), Error>
|
||||||
|
where F: FnOnce(&mut Encoder) -> Result<(), Error>
|
||||||
{
|
{
|
||||||
panic!()
|
panic!()
|
||||||
}
|
}
|
||||||
fn emit_struct(&mut self, _name: &str, _len: uint,
|
fn emit_struct<F>(&mut self, _name: &str, _len: uint, f: F)
|
||||||
f: |&mut Encoder| -> Result<(), Error>) -> Result<(), Error> {
|
-> Result<(), Error>
|
||||||
|
where F: FnOnce(&mut Encoder) -> Result<(), Error>
|
||||||
|
{
|
||||||
match mem::replace(&mut self.state, Start) {
|
match mem::replace(&mut self.state, Start) {
|
||||||
NextKey(key) => {
|
NextKey(key) => {
|
||||||
let mut nested = Encoder::new();
|
let mut nested = Encoder::new();
|
||||||
|
@ -253,9 +261,9 @@ impl serialize::Encoder<Error> for Encoder {
|
||||||
NextMapKey => Err(InvalidMapKeyLocation),
|
NextMapKey => Err(InvalidMapKeyLocation),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fn emit_struct_field(&mut self, f_name: &str, _f_idx: uint,
|
fn emit_struct_field<F>(&mut self, f_name: &str, _f_idx: uint, f: F)
|
||||||
f: |&mut Encoder| -> Result<(), Error>)
|
|
||||||
-> Result<(), Error>
|
-> Result<(), Error>
|
||||||
|
where F: FnOnce(&mut Encoder) -> Result<(), Error>
|
||||||
{
|
{
|
||||||
let old = mem::replace(&mut self.state, NextKey(f_name.to_string()));
|
let old = mem::replace(&mut self.state, NextKey(f_name.to_string()));
|
||||||
try!(f(self));
|
try!(f(self));
|
||||||
|
@ -265,31 +273,33 @@ impl serialize::Encoder<Error> for Encoder {
|
||||||
self.state = old;
|
self.state = old;
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
fn emit_tuple(&mut self, len: uint,
|
fn emit_tuple<F>(&mut self, len: uint, f: F)
|
||||||
f: |&mut Encoder| -> Result<(), Error>) -> Result<(), Error> {
|
-> Result<(), Error>
|
||||||
|
where F: FnOnce(&mut Encoder) -> Result<(), Error>
|
||||||
|
{
|
||||||
self.emit_seq(len, f)
|
self.emit_seq(len, f)
|
||||||
}
|
}
|
||||||
fn emit_tuple_arg(&mut self, idx: uint,
|
fn emit_tuple_arg<F>(&mut self, idx: uint, f: F)
|
||||||
f: |&mut Encoder| -> Result<(), Error>)
|
|
||||||
-> Result<(), Error>
|
-> Result<(), Error>
|
||||||
|
where F: FnOnce(&mut Encoder) -> Result<(), Error>
|
||||||
{
|
{
|
||||||
self.emit_seq_elt(idx, f)
|
self.emit_seq_elt(idx, f)
|
||||||
}
|
}
|
||||||
fn emit_tuple_struct(&mut self, _name: &str, _len: uint,
|
fn emit_tuple_struct<F>(&mut self, _name: &str, _len: uint, _f: F)
|
||||||
_f: |&mut Encoder| -> Result<(), Error>)
|
|
||||||
-> Result<(), Error>
|
-> Result<(), Error>
|
||||||
|
where F: FnOnce(&mut Encoder) -> Result<(), Error>
|
||||||
{
|
{
|
||||||
unimplemented!()
|
unimplemented!()
|
||||||
}
|
}
|
||||||
fn emit_tuple_struct_arg(&mut self, _f_idx: uint,
|
fn emit_tuple_struct_arg<F>(&mut self, _f_idx: uint, _f: F)
|
||||||
_f: |&mut Encoder| -> Result<(), Error>)
|
|
||||||
-> Result<(), Error>
|
-> Result<(), Error>
|
||||||
|
where F: FnOnce(&mut Encoder) -> Result<(), Error>
|
||||||
{
|
{
|
||||||
unimplemented!()
|
unimplemented!()
|
||||||
}
|
}
|
||||||
fn emit_option(&mut self,
|
fn emit_option<F>(&mut self, f: F)
|
||||||
f: |&mut Encoder| -> Result<(), Error>)
|
|
||||||
-> Result<(), Error>
|
-> Result<(), Error>
|
||||||
|
where F: FnOnce(&mut Encoder) -> Result<(), Error>
|
||||||
{
|
{
|
||||||
f(self)
|
f(self)
|
||||||
}
|
}
|
||||||
|
@ -301,15 +311,15 @@ impl serialize::Encoder<Error> for Encoder {
|
||||||
NextMapKey => Err(InvalidMapKeyLocation),
|
NextMapKey => Err(InvalidMapKeyLocation),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fn emit_option_some(&mut self,
|
fn emit_option_some<F>(&mut self, f: F)
|
||||||
f: |&mut Encoder| -> Result<(), Error>)
|
|
||||||
-> Result<(), Error>
|
-> Result<(), Error>
|
||||||
|
where F: FnOnce(&mut Encoder) -> Result<(), Error>
|
||||||
{
|
{
|
||||||
f(self)
|
f(self)
|
||||||
}
|
}
|
||||||
fn emit_seq(&mut self, _len: uint,
|
fn emit_seq<F>(&mut self, _len: uint, f: F)
|
||||||
f: |this: &mut Encoder| -> Result<(), Error>)
|
|
||||||
-> Result<(), Error>
|
-> Result<(), Error>
|
||||||
|
where F: FnOnce(&mut Encoder) -> Result<(), Error>
|
||||||
{
|
{
|
||||||
let old = mem::replace(&mut self.state, NextArray(Vec::new()));
|
let old = mem::replace(&mut self.state, NextArray(Vec::new()));
|
||||||
try!(f(self));
|
try!(f(self));
|
||||||
|
@ -318,19 +328,21 @@ impl serialize::Encoder<Error> for Encoder {
|
||||||
_ => unreachable!(),
|
_ => unreachable!(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fn emit_seq_elt(&mut self, _idx: uint,
|
fn emit_seq_elt<F>(&mut self, _idx: uint, f: F)
|
||||||
f: |this: &mut Encoder| -> Result<(), Error>)
|
|
||||||
-> Result<(), Error>
|
-> Result<(), Error>
|
||||||
|
where F: FnOnce(&mut Encoder) -> Result<(), Error>
|
||||||
{
|
{
|
||||||
f(self)
|
f(self)
|
||||||
}
|
}
|
||||||
fn emit_map(&mut self, len: uint,
|
fn emit_map<F>(&mut self, len: uint, f: F)
|
||||||
f: |&mut Encoder| -> Result<(), Error>) -> Result<(), Error> {
|
-> Result<(), Error>
|
||||||
|
where F: FnOnce(&mut Encoder) -> Result<(), Error>
|
||||||
|
{
|
||||||
self.emit_struct("foo", len, f)
|
self.emit_struct("foo", len, f)
|
||||||
}
|
}
|
||||||
fn emit_map_elt_key(&mut self, _idx: uint,
|
fn emit_map_elt_key<F>(&mut self, _idx: uint, mut f: F)
|
||||||
f: |&mut Encoder| -> Result<(), Error>)
|
|
||||||
-> Result<(), Error>
|
-> Result<(), Error>
|
||||||
|
where F: FnMut(&mut Encoder) -> Result<(), Error>
|
||||||
{
|
{
|
||||||
match mem::replace(&mut self.state, NextMapKey) {
|
match mem::replace(&mut self.state, NextMapKey) {
|
||||||
Start => {}
|
Start => {}
|
||||||
|
@ -342,9 +354,9 @@ impl serialize::Encoder<Error> for Encoder {
|
||||||
_ => Err(InvalidMapKeyLocation),
|
_ => Err(InvalidMapKeyLocation),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fn emit_map_elt_val(&mut self, _idx: uint,
|
fn emit_map_elt_val<F>(&mut self, _idx: uint, f: F)
|
||||||
f: |&mut Encoder| -> Result<(), Error>)
|
|
||||||
-> Result<(), Error>
|
-> Result<(), Error>
|
||||||
|
where F: FnOnce(&mut Encoder) -> Result<(), Error>
|
||||||
{
|
{
|
||||||
f(self)
|
f(self)
|
||||||
}
|
}
|
||||||
|
@ -492,17 +504,17 @@ impl serialize::Decoder<DecodeError> for Decoder {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Compound types:
|
// Compound types:
|
||||||
fn read_enum<T>(&mut self, _name: &str,
|
fn read_enum<T, F>(&mut self, _name: &str, f: F)
|
||||||
f: |&mut Decoder| -> Result<T, DecodeError>)
|
|
||||||
-> Result<T, DecodeError>
|
-> Result<T, DecodeError>
|
||||||
|
where F: FnOnce(&mut Decoder) -> Result<T, DecodeError>
|
||||||
{
|
{
|
||||||
f(self)
|
f(self)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn read_enum_variant<T>(&mut self,
|
fn read_enum_variant<T, F>(&mut self, names: &[&str], mut f: F)
|
||||||
names: &[&str],
|
-> Result<T, DecodeError>
|
||||||
f: |&mut Decoder, uint| -> Result<T, DecodeError>)
|
where F: FnMut(&mut Decoder, uint) -> Result<T, DecodeError>
|
||||||
-> Result<T, DecodeError> {
|
{
|
||||||
let mut first_error = None;
|
let mut first_error = None;
|
||||||
for i in range(0, names.len()) {
|
for i in range(0, names.len()) {
|
||||||
let mut d = self.sub_decoder(self.toml.clone(), "");
|
let mut d = self.sub_decoder(self.toml.clone(), "");
|
||||||
|
@ -517,34 +529,32 @@ impl serialize::Decoder<DecodeError> for Decoder {
|
||||||
}
|
}
|
||||||
Err(first_error.unwrap_or_else(|| self.err(NoEnumVariants)))
|
Err(first_error.unwrap_or_else(|| self.err(NoEnumVariants)))
|
||||||
}
|
}
|
||||||
fn read_enum_variant_arg<T>(&mut self,
|
fn read_enum_variant_arg<T, F>(&mut self, _a_idx: uint, f: F)
|
||||||
_a_idx: uint,
|
-> Result<T, DecodeError>
|
||||||
f: |&mut Decoder| -> Result<T, DecodeError>)
|
where F: FnOnce(&mut Decoder) -> Result<T, DecodeError>
|
||||||
-> Result<T, DecodeError> {
|
{
|
||||||
f(self)
|
f(self)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn read_enum_struct_variant<T>(&mut self,
|
fn read_enum_struct_variant<T, F>(&mut self, _names: &[&str], _f: F)
|
||||||
_names: &[&str],
|
|
||||||
_f: |&mut Decoder, uint|
|
|
||||||
-> Result<T, DecodeError>)
|
|
||||||
-> Result<T, DecodeError>
|
-> Result<T, DecodeError>
|
||||||
|
where F: FnMut(&mut Decoder, uint) -> Result<T, DecodeError>
|
||||||
{
|
{
|
||||||
panic!()
|
panic!()
|
||||||
}
|
}
|
||||||
fn read_enum_struct_variant_field<T>(&mut self,
|
fn read_enum_struct_variant_field<T, F>(&mut self,
|
||||||
_f_name: &str,
|
_f_name: &str,
|
||||||
_f_idx: uint,
|
_f_idx: uint,
|
||||||
_f: |&mut Decoder|
|
_f: F)
|
||||||
-> Result<T, DecodeError>)
|
|
||||||
-> Result<T, DecodeError>
|
-> Result<T, DecodeError>
|
||||||
|
where F: FnOnce(&mut Decoder) -> Result<T, DecodeError>
|
||||||
{
|
{
|
||||||
panic!()
|
panic!()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn read_struct<T>(&mut self, _s_name: &str, _len: uint,
|
fn read_struct<T, F>(&mut self, _s_name: &str, _len: uint, f: F)
|
||||||
f: |&mut Decoder| -> Result<T, DecodeError>)
|
|
||||||
-> Result<T, DecodeError>
|
-> Result<T, DecodeError>
|
||||||
|
where F: FnOnce(&mut Decoder) -> Result<T, DecodeError>
|
||||||
{
|
{
|
||||||
match self.toml {
|
match self.toml {
|
||||||
Some(Table(..)) => {
|
Some(Table(..)) => {
|
||||||
|
@ -559,11 +569,10 @@ impl serialize::Decoder<DecodeError> for Decoder {
|
||||||
ref found => Err(self.mismatch("table", found)),
|
ref found => Err(self.mismatch("table", found)),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fn read_struct_field<T>(&mut self,
|
fn read_struct_field<T, F>(&mut self, f_name: &str, _f_idx: uint, f: F)
|
||||||
f_name: &str,
|
-> Result<T, DecodeError>
|
||||||
_f_idx: uint,
|
where F: FnOnce(&mut Decoder) -> Result<T, DecodeError>
|
||||||
f: |&mut Decoder| -> Result<T, DecodeError>)
|
{
|
||||||
-> Result<T, DecodeError> {
|
|
||||||
let field = f_name.to_string();
|
let field = f_name.to_string();
|
||||||
let toml = match self.toml {
|
let toml = match self.toml {
|
||||||
Some(Table(ref mut table)) => {
|
Some(Table(ref mut table)) => {
|
||||||
|
@ -584,45 +593,41 @@ impl serialize::Decoder<DecodeError> for Decoder {
|
||||||
Ok(ret)
|
Ok(ret)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn read_tuple<T>(&mut self,
|
fn read_tuple<T, F>(&mut self, tuple_len: uint, f: F)
|
||||||
tuple_len: uint,
|
|
||||||
f: |&mut Decoder| -> Result<T, DecodeError>)
|
|
||||||
-> Result<T, DecodeError>
|
-> Result<T, DecodeError>
|
||||||
|
where F: FnOnce(&mut Decoder) -> Result<T, DecodeError>
|
||||||
{
|
{
|
||||||
self.read_seq(|d, len| {
|
self.read_seq(move |d, len| {
|
||||||
assert!(len == tuple_len,
|
assert!(len == tuple_len,
|
||||||
"expected tuple of length `{}`, found tuple \
|
"expected tuple of length `{}`, found tuple \
|
||||||
of length `{}`", tuple_len, len);
|
of length `{}`", tuple_len, len);
|
||||||
f(d)
|
f(d)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
fn read_tuple_arg<T>(&mut self, a_idx: uint,
|
fn read_tuple_arg<T, F>(&mut self, a_idx: uint, f: F)
|
||||||
f: |&mut Decoder| -> Result<T, DecodeError>)
|
|
||||||
-> Result<T, DecodeError>
|
-> Result<T, DecodeError>
|
||||||
|
where F: FnOnce(&mut Decoder) -> Result<T, DecodeError>
|
||||||
{
|
{
|
||||||
self.read_seq_elt(a_idx, f)
|
self.read_seq_elt(a_idx, f)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn read_tuple_struct<T>(&mut self,
|
fn read_tuple_struct<T, F>(&mut self, _s_name: &str, _len: uint, _f: F)
|
||||||
_s_name: &str,
|
|
||||||
_len: uint,
|
|
||||||
_f: |&mut Decoder| -> Result<T, DecodeError>)
|
|
||||||
-> Result<T, DecodeError>
|
-> Result<T, DecodeError>
|
||||||
|
where F: FnOnce(&mut Decoder) -> Result<T, DecodeError>
|
||||||
{
|
{
|
||||||
panic!()
|
panic!()
|
||||||
}
|
}
|
||||||
fn read_tuple_struct_arg<T>(&mut self,
|
fn read_tuple_struct_arg<T, F>(&mut self, _a_idx: uint, _f: F)
|
||||||
_a_idx: uint,
|
|
||||||
_f: |&mut Decoder| -> Result<T, DecodeError>)
|
|
||||||
-> Result<T, DecodeError>
|
-> Result<T, DecodeError>
|
||||||
|
where F: FnOnce(&mut Decoder) -> Result<T, DecodeError>
|
||||||
{
|
{
|
||||||
panic!()
|
panic!()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Specialized types:
|
// Specialized types:
|
||||||
fn read_option<T>(&mut self,
|
fn read_option<T, F>(&mut self, mut f: F)
|
||||||
f: |&mut Decoder, bool| -> Result<T, DecodeError>)
|
|
||||||
-> Result<T, DecodeError>
|
-> Result<T, DecodeError>
|
||||||
|
where F: FnMut(&mut Decoder, bool) -> Result<T, DecodeError>
|
||||||
{
|
{
|
||||||
match self.toml {
|
match self.toml {
|
||||||
Some(..) => f(self, true),
|
Some(..) => f(self, true),
|
||||||
|
@ -630,8 +635,9 @@ impl serialize::Decoder<DecodeError> for Decoder {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn read_seq<T>(&mut self, f: |&mut Decoder, uint| -> Result<T, DecodeError>)
|
fn read_seq<T, F>(&mut self, f: F)
|
||||||
-> Result<T, DecodeError>
|
-> Result<T, DecodeError>
|
||||||
|
where F: FnOnce(&mut Decoder,uint) -> Result<T, DecodeError>
|
||||||
{
|
{
|
||||||
let len = match self.toml {
|
let len = match self.toml {
|
||||||
Some(Array(ref arr)) => arr.len(),
|
Some(Array(ref arr)) => arr.len(),
|
||||||
|
@ -649,9 +655,9 @@ impl serialize::Decoder<DecodeError> for Decoder {
|
||||||
self.toml.take();
|
self.toml.take();
|
||||||
Ok(ret)
|
Ok(ret)
|
||||||
}
|
}
|
||||||
fn read_seq_elt<T>(&mut self, idx: uint,
|
fn read_seq_elt<T, F>(&mut self, idx: uint, f: F)
|
||||||
f: |&mut Decoder| -> Result<T, DecodeError>)
|
|
||||||
-> Result<T, DecodeError>
|
-> Result<T, DecodeError>
|
||||||
|
where F: FnOnce(&mut Decoder) -> Result<T, DecodeError>
|
||||||
{
|
{
|
||||||
let toml = match self.toml {
|
let toml = match self.toml {
|
||||||
Some(Array(ref mut arr)) => mem::replace(&mut arr[idx], Integer(0)),
|
Some(Array(ref mut arr)) => mem::replace(&mut arr[idx], Integer(0)),
|
||||||
|
@ -669,8 +675,9 @@ impl serialize::Decoder<DecodeError> for Decoder {
|
||||||
Ok(ret)
|
Ok(ret)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn read_map<T>(&mut self, f: |&mut Decoder, uint| -> Result<T, DecodeError>)
|
fn read_map<T, F>(&mut self, f: F)
|
||||||
-> Result<T, DecodeError>
|
-> Result<T, DecodeError>
|
||||||
|
where F: FnOnce(&mut Decoder, uint) -> Result<T, DecodeError>
|
||||||
{
|
{
|
||||||
let len = match self.toml {
|
let len = match self.toml {
|
||||||
Some(Table(ref table)) => table.len(),
|
Some(Table(ref table)) => table.len(),
|
||||||
|
@ -680,9 +687,9 @@ impl serialize::Decoder<DecodeError> for Decoder {
|
||||||
self.toml.take();
|
self.toml.take();
|
||||||
Ok(ret)
|
Ok(ret)
|
||||||
}
|
}
|
||||||
fn read_map_elt_key<T>(&mut self, idx: uint,
|
fn read_map_elt_key<T, F>(&mut self, idx: uint, f: F)
|
||||||
f: |&mut Decoder| -> Result<T, DecodeError>)
|
|
||||||
-> Result<T, DecodeError>
|
-> Result<T, DecodeError>
|
||||||
|
where F: FnOnce(&mut Decoder) -> Result<T, DecodeError>
|
||||||
{
|
{
|
||||||
match self.toml {
|
match self.toml {
|
||||||
Some(Table(ref table)) => {
|
Some(Table(ref table)) => {
|
||||||
|
@ -697,9 +704,9 @@ impl serialize::Decoder<DecodeError> for Decoder {
|
||||||
ref found => Err(self.mismatch("table", found)),
|
ref found => Err(self.mismatch("table", found)),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fn read_map_elt_val<T>(&mut self, idx: uint,
|
fn read_map_elt_val<T, F>(&mut self, idx: uint, f: F)
|
||||||
f: |&mut Decoder| -> Result<T, DecodeError>)
|
|
||||||
-> Result<T, DecodeError>
|
-> Result<T, DecodeError>
|
||||||
|
where F: FnOnce(&mut Decoder) -> Result<T, DecodeError>
|
||||||
{
|
{
|
||||||
match self.toml {
|
match self.toml {
|
||||||
Some(Table(ref table)) => {
|
Some(Table(ref table)) => {
|
||||||
|
@ -760,7 +767,7 @@ impl fmt::Show for DecodeError {
|
||||||
NilTooLong => {
|
NilTooLong => {
|
||||||
write!(f, "expected 0-length string")
|
write!(f, "expected 0-length string")
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
match self.field {
|
match self.field {
|
||||||
Some(ref s) => {
|
Some(ref s) => {
|
||||||
write!(f, " for the key `{}`", s)
|
write!(f, " for the key `{}`", s)
|
||||||
|
@ -816,18 +823,18 @@ mod tests {
|
||||||
let mut e = Encoder::new();
|
let mut e = Encoder::new();
|
||||||
$t.encode(&mut e).unwrap();
|
$t.encode(&mut e).unwrap();
|
||||||
e.toml
|
e.toml
|
||||||
}) )
|
}) );
|
||||||
|
|
||||||
macro_rules! decode( ($t:expr) => ({
|
macro_rules! decode( ($t:expr) => ({
|
||||||
let mut d = Decoder::new($t);
|
let mut d = Decoder::new($t);
|
||||||
Decodable::decode(&mut d).unwrap()
|
Decodable::decode(&mut d).unwrap()
|
||||||
}) )
|
}) );
|
||||||
|
|
||||||
macro_rules! map( ($($k:ident: $v:expr),*) => ({
|
macro_rules! map( ($($k:ident: $v:expr),*) => ({
|
||||||
let mut _m = TreeMap::new();
|
let mut _m = TreeMap::new();
|
||||||
$(_m.insert(stringify!($k).to_string(), $v);)*
|
$(_m.insert(stringify!($k).to_string(), $v);)*
|
||||||
_m
|
_m
|
||||||
}) )
|
}) );
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn smoke() {
|
fn smoke() {
|
||||||
|
|
28
src/show.rs
28
src/show.rs
|
@ -109,34 +109,34 @@ mod tests {
|
||||||
let mut _m = TreeMap::new();
|
let mut _m = TreeMap::new();
|
||||||
$(_m.insert($k.to_string(), $v);)*
|
$(_m.insert($k.to_string(), $v);)*
|
||||||
_m
|
_m
|
||||||
}) )
|
}) );
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn simple_show() {
|
fn simple_show() {
|
||||||
assert_eq!(String("foo".to_string()).to_string().as_slice(),
|
assert_eq!(String("foo".to_string()).to_string().as_slice(),
|
||||||
"\"foo\"")
|
"\"foo\"");
|
||||||
assert_eq!(Integer(10).to_string().as_slice(),
|
assert_eq!(Integer(10).to_string().as_slice(),
|
||||||
"10")
|
"10");
|
||||||
assert_eq!(Float(10.0).to_string().as_slice(),
|
assert_eq!(Float(10.0).to_string().as_slice(),
|
||||||
"10.0")
|
"10.0");
|
||||||
assert_eq!(Float(2.4).to_string().as_slice(),
|
assert_eq!(Float(2.4).to_string().as_slice(),
|
||||||
"2.4")
|
"2.4");
|
||||||
assert_eq!(Boolean(true).to_string().as_slice(),
|
assert_eq!(Boolean(true).to_string().as_slice(),
|
||||||
"true")
|
"true");
|
||||||
assert_eq!(Datetime("test".to_string()).to_string().as_slice(),
|
assert_eq!(Datetime("test".to_string()).to_string().as_slice(),
|
||||||
"test")
|
"test");
|
||||||
assert_eq!(Array(vec![]).to_string().as_slice(),
|
assert_eq!(Array(vec![]).to_string().as_slice(),
|
||||||
"[]")
|
"[]");
|
||||||
assert_eq!(Array(vec![Integer(1), Integer(2)]).to_string().as_slice(),
|
assert_eq!(Array(vec![Integer(1), Integer(2)]).to_string().as_slice(),
|
||||||
"[1, 2]")
|
"[1, 2]");
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn table() {
|
fn table() {
|
||||||
assert_eq!(Table(map! { }).to_string().as_slice(),
|
assert_eq!(Table(map! { }).to_string().as_slice(),
|
||||||
"")
|
"");
|
||||||
assert_eq!(Table(map! { "test": Integer(2) }).to_string().as_slice(),
|
assert_eq!(Table(map! { "test": Integer(2) }).to_string().as_slice(),
|
||||||
"test = 2\n")
|
"test = 2\n");
|
||||||
assert_eq!(Table(map! {
|
assert_eq!(Table(map! {
|
||||||
"test": Integer(2),
|
"test": Integer(2),
|
||||||
"test2": Table(map! {
|
"test2": Table(map! {
|
||||||
|
@ -146,7 +146,7 @@ mod tests {
|
||||||
"test = 2\n\
|
"test = 2\n\
|
||||||
\n\
|
\n\
|
||||||
[test2]\n\
|
[test2]\n\
|
||||||
test = \"wut\"\n")
|
test = \"wut\"\n");
|
||||||
assert_eq!(Table(map! {
|
assert_eq!(Table(map! {
|
||||||
"test": Integer(2),
|
"test": Integer(2),
|
||||||
"test2": Table(map! {
|
"test2": Table(map! {
|
||||||
|
@ -156,7 +156,7 @@ mod tests {
|
||||||
"test = 2\n\
|
"test = 2\n\
|
||||||
\n\
|
\n\
|
||||||
[test2]\n\
|
[test2]\n\
|
||||||
test = \"wut\"\n")
|
test = \"wut\"\n");
|
||||||
assert_eq!(Table(map! {
|
assert_eq!(Table(map! {
|
||||||
"test": Integer(2),
|
"test": Integer(2),
|
||||||
"test2": Array(vec![Table(map! {
|
"test2": Array(vec![Table(map! {
|
||||||
|
@ -166,6 +166,6 @@ mod tests {
|
||||||
"test = 2\n\
|
"test = 2\n\
|
||||||
\n\
|
\n\
|
||||||
[[test2]]\n\
|
[[test2]]\n\
|
||||||
test = \"wut\"\n")
|
test = \"wut\"\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,67 +10,67 @@ fn run(toml: &str) {
|
||||||
macro_rules! test( ($name:ident, $toml:expr) => (
|
macro_rules! test( ($name:ident, $toml:expr) => (
|
||||||
#[test]
|
#[test]
|
||||||
fn $name() { run($toml); }
|
fn $name() { run($toml); }
|
||||||
) )
|
) );
|
||||||
|
|
||||||
test!(array_mixed_types_arrays_and_ints,
|
test!(array_mixed_types_arrays_and_ints,
|
||||||
include_str!("invalid/array-mixed-types-arrays-and-ints.toml"))
|
include_str!("invalid/array-mixed-types-arrays-and-ints.toml"));
|
||||||
test!(array_mixed_types_ints_and_floats,
|
test!(array_mixed_types_ints_and_floats,
|
||||||
include_str!("invalid/array-mixed-types-ints-and-floats.toml"))
|
include_str!("invalid/array-mixed-types-ints-and-floats.toml"));
|
||||||
test!(array_mixed_types_strings_and_ints,
|
test!(array_mixed_types_strings_and_ints,
|
||||||
include_str!("invalid/array-mixed-types-strings-and-ints.toml"))
|
include_str!("invalid/array-mixed-types-strings-and-ints.toml"));
|
||||||
test!(datetime_malformed_no_leads,
|
test!(datetime_malformed_no_leads,
|
||||||
include_str!("invalid/datetime-malformed-no-leads.toml"))
|
include_str!("invalid/datetime-malformed-no-leads.toml"));
|
||||||
test!(datetime_malformed_no_secs,
|
test!(datetime_malformed_no_secs,
|
||||||
include_str!("invalid/datetime-malformed-no-secs.toml"))
|
include_str!("invalid/datetime-malformed-no-secs.toml"));
|
||||||
test!(datetime_malformed_no_t,
|
test!(datetime_malformed_no_t,
|
||||||
include_str!("invalid/datetime-malformed-no-t.toml"))
|
include_str!("invalid/datetime-malformed-no-t.toml"));
|
||||||
test!(datetime_malformed_no_z,
|
test!(datetime_malformed_no_z,
|
||||||
include_str!("invalid/datetime-malformed-no-z.toml"))
|
include_str!("invalid/datetime-malformed-no-z.toml"));
|
||||||
test!(datetime_malformed_with_milli,
|
test!(datetime_malformed_with_milli,
|
||||||
include_str!("invalid/datetime-malformed-with-milli.toml"))
|
include_str!("invalid/datetime-malformed-with-milli.toml"));
|
||||||
test!(duplicate_keys,
|
test!(duplicate_keys,
|
||||||
include_str!("invalid/duplicate-keys.toml"))
|
include_str!("invalid/duplicate-keys.toml"));
|
||||||
test!(duplicate_key_table,
|
test!(duplicate_key_table,
|
||||||
include_str!("invalid/duplicate-key-table.toml"))
|
include_str!("invalid/duplicate-key-table.toml"));
|
||||||
test!(duplicate_tables,
|
test!(duplicate_tables,
|
||||||
include_str!("invalid/duplicate-tables.toml"))
|
include_str!("invalid/duplicate-tables.toml"));
|
||||||
test!(empty_implicit_table,
|
test!(empty_implicit_table,
|
||||||
include_str!("invalid/empty-implicit-table.toml"))
|
include_str!("invalid/empty-implicit-table.toml"));
|
||||||
test!(empty_table,
|
test!(empty_table,
|
||||||
include_str!("invalid/empty-table.toml"))
|
include_str!("invalid/empty-table.toml"));
|
||||||
test!(float_no_leading_zero,
|
test!(float_no_leading_zero,
|
||||||
include_str!("invalid/float-no-leading-zero.toml"))
|
include_str!("invalid/float-no-leading-zero.toml"));
|
||||||
test!(float_no_trailing_digits,
|
test!(float_no_trailing_digits,
|
||||||
include_str!("invalid/float-no-trailing-digits.toml"))
|
include_str!("invalid/float-no-trailing-digits.toml"));
|
||||||
test!(key_two_equals,
|
test!(key_two_equals,
|
||||||
include_str!("invalid/key-two-equals.toml"))
|
include_str!("invalid/key-two-equals.toml"));
|
||||||
test!(string_bad_byte_escape,
|
test!(string_bad_byte_escape,
|
||||||
include_str!("invalid/string-bad-byte-escape.toml"))
|
include_str!("invalid/string-bad-byte-escape.toml"));
|
||||||
test!(string_bad_escape,
|
test!(string_bad_escape,
|
||||||
include_str!("invalid/string-bad-escape.toml"))
|
include_str!("invalid/string-bad-escape.toml"));
|
||||||
test!(string_byte_escapes,
|
test!(string_byte_escapes,
|
||||||
include_str!("invalid/string-byte-escapes.toml"))
|
include_str!("invalid/string-byte-escapes.toml"));
|
||||||
test!(string_no_close,
|
test!(string_no_close,
|
||||||
include_str!("invalid/string-no-close.toml"))
|
include_str!("invalid/string-no-close.toml"));
|
||||||
test!(table_array_implicit,
|
test!(table_array_implicit,
|
||||||
include_str!("invalid/table-array-implicit.toml"))
|
include_str!("invalid/table-array-implicit.toml"));
|
||||||
test!(table_array_malformed_bracket,
|
test!(table_array_malformed_bracket,
|
||||||
include_str!("invalid/table-array-malformed-bracket.toml"))
|
include_str!("invalid/table-array-malformed-bracket.toml"));
|
||||||
test!(table_array_malformed_empty,
|
test!(table_array_malformed_empty,
|
||||||
include_str!("invalid/table-array-malformed-empty.toml"))
|
include_str!("invalid/table-array-malformed-empty.toml"));
|
||||||
test!(table_nested_brackets_close,
|
test!(table_nested_brackets_close,
|
||||||
include_str!("invalid/table-nested-brackets-close.toml"))
|
include_str!("invalid/table-nested-brackets-close.toml"));
|
||||||
test!(table_nested_brackets_open,
|
test!(table_nested_brackets_open,
|
||||||
include_str!("invalid/table-nested-brackets-open.toml"))
|
include_str!("invalid/table-nested-brackets-open.toml"));
|
||||||
test!(text_after_array_entries,
|
test!(text_after_array_entries,
|
||||||
include_str!("invalid/text-after-array-entries.toml"))
|
include_str!("invalid/text-after-array-entries.toml"));
|
||||||
test!(text_after_integer,
|
test!(text_after_integer,
|
||||||
include_str!("invalid/text-after-integer.toml"))
|
include_str!("invalid/text-after-integer.toml"));
|
||||||
test!(text_after_string,
|
test!(text_after_string,
|
||||||
include_str!("invalid/text-after-string.toml"))
|
include_str!("invalid/text-after-string.toml"));
|
||||||
test!(text_after_table,
|
test!(text_after_table,
|
||||||
include_str!("invalid/text-after-table.toml"))
|
include_str!("invalid/text-after-table.toml"));
|
||||||
test!(text_before_array_separator,
|
test!(text_before_array_separator,
|
||||||
include_str!("invalid/text-before-array-separator.toml"))
|
include_str!("invalid/text-before-array-separator.toml"));
|
||||||
test!(text_in_array,
|
test!(text_in_array,
|
||||||
include_str!("invalid/text-in-array.toml"))
|
include_str!("invalid/text-in-array.toml"));
|
||||||
|
|
|
@ -64,104 +64,104 @@ fn run(toml: &str, json: &str) {
|
||||||
macro_rules! test( ($name:ident, $toml:expr, $json:expr) => (
|
macro_rules! test( ($name:ident, $toml:expr, $json:expr) => (
|
||||||
#[test]
|
#[test]
|
||||||
fn $name() { run($toml, $json); }
|
fn $name() { run($toml, $json); }
|
||||||
) )
|
) );
|
||||||
|
|
||||||
test!(array_empty,
|
test!(array_empty,
|
||||||
include_str!("valid/array-empty.toml"),
|
include_str!("valid/array-empty.toml"),
|
||||||
include_str!("valid/array-empty.json"))
|
include_str!("valid/array-empty.json"));
|
||||||
test!(array_nospaces,
|
test!(array_nospaces,
|
||||||
include_str!("valid/array-nospaces.toml"),
|
include_str!("valid/array-nospaces.toml"),
|
||||||
include_str!("valid/array-nospaces.json"))
|
include_str!("valid/array-nospaces.json"));
|
||||||
test!(arrays_hetergeneous,
|
test!(arrays_hetergeneous,
|
||||||
include_str!("valid/arrays-hetergeneous.toml"),
|
include_str!("valid/arrays-hetergeneous.toml"),
|
||||||
include_str!("valid/arrays-hetergeneous.json"))
|
include_str!("valid/arrays-hetergeneous.json"));
|
||||||
test!(arrays,
|
test!(arrays,
|
||||||
include_str!("valid/arrays.toml"),
|
include_str!("valid/arrays.toml"),
|
||||||
include_str!("valid/arrays.json"))
|
include_str!("valid/arrays.json"));
|
||||||
test!(arrays_nested,
|
test!(arrays_nested,
|
||||||
include_str!("valid/arrays-nested.toml"),
|
include_str!("valid/arrays-nested.toml"),
|
||||||
include_str!("valid/arrays-nested.json"))
|
include_str!("valid/arrays-nested.json"));
|
||||||
test!(empty,
|
test!(empty,
|
||||||
include_str!("valid/empty.toml"),
|
include_str!("valid/empty.toml"),
|
||||||
include_str!("valid/empty.json"))
|
include_str!("valid/empty.json"));
|
||||||
test!(bool,
|
test!(bool,
|
||||||
include_str!("valid/bool.toml"),
|
include_str!("valid/bool.toml"),
|
||||||
include_str!("valid/bool.json"))
|
include_str!("valid/bool.json"));
|
||||||
test!(datetime,
|
test!(datetime,
|
||||||
include_str!("valid/datetime.toml"),
|
include_str!("valid/datetime.toml"),
|
||||||
include_str!("valid/datetime.json"))
|
include_str!("valid/datetime.json"));
|
||||||
test!(example,
|
test!(example,
|
||||||
include_str!("valid/example.toml"),
|
include_str!("valid/example.toml"),
|
||||||
include_str!("valid/example.json"))
|
include_str!("valid/example.json"));
|
||||||
test!(float,
|
test!(float,
|
||||||
include_str!("valid/float.toml"),
|
include_str!("valid/float.toml"),
|
||||||
include_str!("valid/float.json"))
|
include_str!("valid/float.json"));
|
||||||
test!(implicit_and_explicit_after,
|
test!(implicit_and_explicit_after,
|
||||||
include_str!("valid/implicit-and-explicit-after.toml"),
|
include_str!("valid/implicit-and-explicit-after.toml"),
|
||||||
include_str!("valid/implicit-and-explicit-after.json"))
|
include_str!("valid/implicit-and-explicit-after.json"));
|
||||||
test!(implicit_and_explicit_before,
|
test!(implicit_and_explicit_before,
|
||||||
include_str!("valid/implicit-and-explicit-before.toml"),
|
include_str!("valid/implicit-and-explicit-before.toml"),
|
||||||
include_str!("valid/implicit-and-explicit-before.json"))
|
include_str!("valid/implicit-and-explicit-before.json"));
|
||||||
test!(implicit_groups,
|
test!(implicit_groups,
|
||||||
include_str!("valid/implicit-groups.toml"),
|
include_str!("valid/implicit-groups.toml"),
|
||||||
include_str!("valid/implicit-groups.json"))
|
include_str!("valid/implicit-groups.json"));
|
||||||
test!(integer,
|
test!(integer,
|
||||||
include_str!("valid/integer.toml"),
|
include_str!("valid/integer.toml"),
|
||||||
include_str!("valid/integer.json"))
|
include_str!("valid/integer.json"));
|
||||||
test!(key_equals_nospace,
|
test!(key_equals_nospace,
|
||||||
include_str!("valid/key-equals-nospace.toml"),
|
include_str!("valid/key-equals-nospace.toml"),
|
||||||
include_str!("valid/key-equals-nospace.json"))
|
include_str!("valid/key-equals-nospace.json"));
|
||||||
test!(key_special_chars,
|
test!(key_special_chars,
|
||||||
include_str!("valid/key-special-chars.toml"),
|
include_str!("valid/key-special-chars.toml"),
|
||||||
include_str!("valid/key-special-chars.json"))
|
include_str!("valid/key-special-chars.json"));
|
||||||
test!(key_with_pound,
|
test!(key_with_pound,
|
||||||
include_str!("valid/key-with-pound.toml"),
|
include_str!("valid/key-with-pound.toml"),
|
||||||
include_str!("valid/key-with-pound.json"))
|
include_str!("valid/key-with-pound.json"));
|
||||||
test!(long_float,
|
test!(long_float,
|
||||||
include_str!("valid/long-float.toml"),
|
include_str!("valid/long-float.toml"),
|
||||||
include_str!("valid/long-float.json"))
|
include_str!("valid/long-float.json"));
|
||||||
test!(long_integer,
|
test!(long_integer,
|
||||||
include_str!("valid/long-integer.toml"),
|
include_str!("valid/long-integer.toml"),
|
||||||
include_str!("valid/long-integer.json"))
|
include_str!("valid/long-integer.json"));
|
||||||
test!(string_empty,
|
test!(string_empty,
|
||||||
include_str!("valid/string-empty.toml"),
|
include_str!("valid/string-empty.toml"),
|
||||||
include_str!("valid/string-empty.json"))
|
include_str!("valid/string-empty.json"));
|
||||||
test!(string_escapes,
|
test!(string_escapes,
|
||||||
include_str!("valid/string-escapes.toml"),
|
include_str!("valid/string-escapes.toml"),
|
||||||
include_str!("valid/string-escapes.json"))
|
include_str!("valid/string-escapes.json"));
|
||||||
test!(string_simple,
|
test!(string_simple,
|
||||||
include_str!("valid/string-simple.toml"),
|
include_str!("valid/string-simple.toml"),
|
||||||
include_str!("valid/string-simple.json"))
|
include_str!("valid/string-simple.json"));
|
||||||
test!(string_with_pound,
|
test!(string_with_pound,
|
||||||
include_str!("valid/string-with-pound.toml"),
|
include_str!("valid/string-with-pound.toml"),
|
||||||
include_str!("valid/string-with-pound.json"))
|
include_str!("valid/string-with-pound.json"));
|
||||||
test!(table_array_implicit,
|
test!(table_array_implicit,
|
||||||
include_str!("valid/table-array-implicit.toml"),
|
include_str!("valid/table-array-implicit.toml"),
|
||||||
include_str!("valid/table-array-implicit.json"))
|
include_str!("valid/table-array-implicit.json"));
|
||||||
test!(table_array_many,
|
test!(table_array_many,
|
||||||
include_str!("valid/table-array-many.toml"),
|
include_str!("valid/table-array-many.toml"),
|
||||||
include_str!("valid/table-array-many.json"))
|
include_str!("valid/table-array-many.json"));
|
||||||
test!(table_array_nest,
|
test!(table_array_nest,
|
||||||
include_str!("valid/table-array-nest.toml"),
|
include_str!("valid/table-array-nest.toml"),
|
||||||
include_str!("valid/table-array-nest.json"))
|
include_str!("valid/table-array-nest.json"));
|
||||||
test!(table_array_one,
|
test!(table_array_one,
|
||||||
include_str!("valid/table-array-one.toml"),
|
include_str!("valid/table-array-one.toml"),
|
||||||
include_str!("valid/table-array-one.json"))
|
include_str!("valid/table-array-one.json"));
|
||||||
test!(table_empty,
|
test!(table_empty,
|
||||||
include_str!("valid/table-empty.toml"),
|
include_str!("valid/table-empty.toml"),
|
||||||
include_str!("valid/table-empty.json"))
|
include_str!("valid/table-empty.json"));
|
||||||
test!(table_sub_empty,
|
test!(table_sub_empty,
|
||||||
include_str!("valid/table-sub-empty.toml"),
|
include_str!("valid/table-sub-empty.toml"),
|
||||||
include_str!("valid/table-sub-empty.json"))
|
include_str!("valid/table-sub-empty.json"));
|
||||||
test!(table_whitespace,
|
test!(table_whitespace,
|
||||||
include_str!("valid/table-whitespace.toml"),
|
include_str!("valid/table-whitespace.toml"),
|
||||||
include_str!("valid/table-whitespace.json"))
|
include_str!("valid/table-whitespace.json"));
|
||||||
test!(table_with_pound,
|
test!(table_with_pound,
|
||||||
include_str!("valid/table-with-pound.toml"),
|
include_str!("valid/table-with-pound.toml"),
|
||||||
include_str!("valid/table-with-pound.json"))
|
include_str!("valid/table-with-pound.json"));
|
||||||
test!(unicode_escape,
|
test!(unicode_escape,
|
||||||
include_str!("valid/unicode-escape.toml"),
|
include_str!("valid/unicode-escape.toml"),
|
||||||
include_str!("valid/unicode-escape.json"))
|
include_str!("valid/unicode-escape.json"));
|
||||||
test!(unicode_literal,
|
test!(unicode_literal,
|
||||||
include_str!("valid/unicode-literal.toml"),
|
include_str!("valid/unicode-literal.toml"),
|
||||||
include_str!("valid/unicode-literal.json"))
|
include_str!("valid/unicode-literal.json"));
|
||||||
|
|
Loading…
Reference in a new issue