temp

[?]
Jun 29, 2021, 8:16 AM
TMYMF5L66ABESNWY4KP54E4FDPHXSZPAU4M2VN4K26Q4Y7BVUUYAC

Dependencies

Change contents

  • replacement in src/parser.rs at line 5
    [5.2330][5.2330:2368]()
    use crate::error::{Error, ErrorKind};
    [5.2330]
    [5.2368]
    use crate::error::*;
  • edit in src/parser.rs at line 22
    [5.2768]
    [5.2768]
    // Relays error back to a function which knowns the token. (chars indented relative to root key)
    struct InnerBadIndent(usize);
  • edit in src/parser.rs at line 26
    [5.2769]
    [5.2769]
    impl InnerBadIndent {
    fn from_inner(token: &Token, line: Line) -> std::result::Result<u32, Error> {
    bad_indent
    let indent = indent(
    &mut root_indent,
    line_start,
    start_key
    ).map_err(|err| err.from_inner(&token, line))?;
    }
  • replacement in src/parser.rs at line 112
    [5.4577][5.4577:4660]()
    Err(Error::new(ErrorKind::FirstTokenMustBeKey(token.to_string())))
    [5.4577]
    [5.4660]
    Err(first_token_must_be_key(token.to_string()))
  • replacement in src/parser.rs at line 154
    [5.6106][5.6106:6176]()
    return Err(Error::new(ErrorKind::NonRootNoIndent(
    [5.6106]
    [5.6176]
    return Err(non_root_indent(
  • replacement in src/parser.rs at line 157
    [5.6256][5.6256:6280]()
    )))
    [5.6256]
    [5.6280]
    ))
  • replacement in src/parser.rs at line 204
    [5.8072][5.8072:8143]()
    if s == "" { return Err(Error::new(ErrorKind::EmptyString)) };
    [5.8072]
    [5.8143]
    if s == "" { return Err(empty_string()) };
  • replacement in src/parser.rs at line 286
    [5.322][5.322:386]()
    ).map_err(|e| e.from_inner(&token, line))?;
    [5.322]
    [5.10869]
    ).map_err(|err| err.from_inner(&token, line))?;
  • replacement in src/parser.rs at line 367
    [5.13553][5.827:922]()
    return Err(Error::new(
    ErrorKind::NoColonAfterKey(
    [5.13553]
    [5.922]
    return Err(
    no_colon_after_key(
  • replacement in src/parser.rs at line 371
    [5.998][5.998:1022]()
    ));
    [5.998]
    [5.13648]
    );
  • replacement in src/parser.rs at line 375
    [5.13777][5.1023:1066]()
    return Err(Error::new(
    [5.13777]
    [5.1066]
    return Err(
  • replacement in src/parser.rs at line 380
    [5.1201][5.1201:1225]()
    ));
    [5.1201]
    [5.13879]
    )
  • replacement in src/parser.rs at line 386
    [5.13974][5.1226:1344]()
    return Err(Error::new(
    ErrorKind::NoSpaceAfterKey)
    );
    [5.13974]
    [5.14046]
    return Err(non_space_after_key());
  • replacement in src/parser.rs at line 393
    [3.31][5.1345:1439](),[5.14181][5.1345:1439]()
    return Err(Error::new(
    ErrorKind::IncompleteLine(
    [3.31]
    [3.32]
    return Err(
    incomplete_line(
  • replacement in src/parser.rs at line 398
    [5.1511][5.1511:1534]()
    ))
    [5.1511]
    [5.14270]
    )
  • replacement in src/parser.rs at line 403
    [5.14429][5.1535:1629]()
    return Err(Error::new(
    ErrorKind::IncompleteLine(
    [5.14429]
    [3.157]
    return Err(
    incomplete_line(
  • replacement in src/parser.rs at line 408
    [5.1705][5.1705:1729]()
    ));
    [5.1705]
    [5.14523]
    );
  • replacement in src/parser.rs at line 415
    [5.14661][5.1730:1847]()
    return Err(Error::new(
    ErrorKind::ColonBeforeKey)
    );
    [5.14661]
    [5.14732]
    return Err(colon_before_key())
  • replacement in src/parser.rs at line 419
    [5.14834][5.1848:1965]()
    return Err(Error::new(
    ErrorKind::ColonBeforeKey)
    );
    [5.14834]
    [5.14905]
    return Err(colon_before_key())
  • replacement in src/parser.rs at line 422
    [5.14968][5.1966:2084]()
    return Err(Error::new(
    ErrorKind::NoSpaceAfterKey
    ));
    [5.14968]
    [5.15040]
    return Err(no_space_after_key())
  • replacement in src/parser.rs at line 428
    [5.15385][5.2288:2406]()
    return Err(Error::new(
    ErrorKind::NoSpaceAfterKey)
    );
    [5.15385]
    [5.15457]
    return Err(no_space_after_key)
  • replacement in src/parser.rs at line 441
    [5.15735][5.2407:2501]()
    return Err(Error::new(
    ErrorKind::IncompleteCommentOrKey(
    [5.15735]
    [5.2501]
    return Err(
    incomplete_comment_or_key(
  • replacement in src/parser.rs at line 446
    [5.2570][5.2570:2590]()
    ));
    [5.2570]
    [5.15833]
    )
  • replacement in src/parser.rs at line 451
    [5.15952][5.2591:2677]()
    return Err(Error::new(
    ErrorKind::IncompleteLine(
    [5.15952]
    [3.282]
    return Err(
    incomplete_line(
  • replacement in src/parser.rs at line 456
    [5.2745][5.2745:2765]()
    ));
    [5.2745]
    [5.16042]
    )
  • replacement in src/parser.rs at line 518
    [5.17883][5.17883:17927]()
    start_key: usize) -> Result<usize>
    [5.17883]
    [5.17927]
    start_key: usize) -> std::result::Result<usize, InnerBadIndent>
  • replacement in src/parser.rs at line 533
    [5.18249][5.3815:3980]()
    return Err(Error::new(
    ErrorKind::InnerBadIndent(
    chars_indent
    )
    ));
    [5.18249]
    [5.18330]
    return Err(InnerBadIndent(chars_indent))
  • replacement in src/lib.rs at line 322
    [5.4833][5.4833:4882]()
    ErrorKind::EKeyFKeyValue
    [5.4833]
    [5.4882]
    ErrorKind::Expected_key_found_keyvalue
  • replacement in src/lib.rs at line 353
    [5.5449][5.5449:5501]()
    | ErrorKind::EKeyFKeyValue => {
    [5.5449]
    [5.5501]
    | ErrorKind::Expected_key_found_keyvalue => {
  • replacement in src/into.rs at line 59
    [5.30129][5.5382:5489]()
    Some(i) => Err(Error::new(ErrorKind::EUniqueKeyValueFMany(String::from("todo"), *i))),
    [5.30129]
    [5.30210]
    Some(i) => Err(Error::new(ErrorKind::Expected_unique_keyvalue_found_multi(String::from("todo"), *i))),
  • replacement in src/into.rs at line 73
    [5.30794][5.30794:30870]()
    Token::Key { .. } => Err(Error::new(ErrorKind::EKeyValueFKey)),
    [5.30794]
    [5.30870]
    Token::Key { .. } => Err(Error::new(ErrorKind::Expected_keyvalue_found_key)),
  • edit in src/error.rs at line 8
    [5.36683][5.36683:36893]()
    // `ErrorKind` uses only owned strings or copy types as parameters. This means
    // that `Error`s in client code do not require a lifetime, which could cause
    // trouble if the error is wrapped and passed around.
  • replacement in src/error.rs at line 9
    [5.36917][5.36917:36955](),[5.36955][4.662:663](),[4.663][5.36955:36956](),[5.36955][5.36955:36956]()
    pub struct Error(pub Box<ErrorKind>);
    [5.36917]
    [4.664]
    pub struct Error(String);
  • edit in src/error.rs at line 11
    [4.665][5.36956:37048](),[5.36956][5.36956:37048]()
    impl Error {
    pub fn new(kind: ErrorKind) -> Error {
    Error(Box::new(kind))
    }
  • replacement in src/error.rs at line 12
    [5.37049][5.37049:37111]()
    pub fn kind(&self) -> ErrorKind {
    *self.0.clone()
    [5.37049]
    [5.37111]
    impl fmt::Display for Error {
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
    write!(f, "{}", self.0)
  • edit in src/error.rs at line 16
    [5.37117][5.37117:37158](),[5.37158][5.5989:6092](),[5.6092][5.37219:37298](),[5.37219][5.37219:37298](),[5.37298][5.6093:6175](),[5.6175][5.37374:37428](),[5.37374][5.37374:37428]()
    // Maps InnerBadIndent to BadIndent
    pub fn from_inner<T: Display>(
    self,
    token: T,
    line: usize) -> Error
    {
    match self.kind() {
    ErrorKind::InnerBadIndent(indent) => {
    Error::new(ErrorKind::BadIndent(token.to_string(), line, indent))
    },
    _ => self,
    }
    }
  • replacement in src/error.rs at line 18
    [5.37431][5.37431:37477](),[5.37477][5.5490:5544](),[5.5544][5.37477:37603](),[5.37477][5.37477:37603](),[5.37603][5.5545:5644](),[5.5644][5.37675:37700](),[5.37675][5.37675:37700](),[5.37700][5.1388:1446](),[5.1446][5.37842:37954](),[5.37842][5.37842:37954](),[5.37954][5.6176:6290](),[5.6290][5.38055:38352](),[5.38055][5.38055:38352](),[5.38352][5.236:278](),[5.278][5.38388:38428](),[5.38388][5.38388:38428](),[5.38428][3.371:405](),[3.405][5.38456:38892](),[5.38456][5.38456:38892]()
    #[derive(Clone, Debug)]
    pub enum ErrorKind {
    // Can be used by client code.
    User(String),
    // Expected key, found key/value pair.
    EKeyFKeyValue,
    // Expected key/value pair, found key.
    EKeyValueFKey,
    // Expected a key/value pair, found many (token, pos)
    EUniqueKeyValueFMany(String, usize),
    EUniqueTokenFMany,
    // `FromStr(keyval, pos)
    FromStr(String, String),
    NoChildWithSegment(String, String, String),
    // Use adjective_noun for error names.
    EmptyString,
    // BadIndent(token as string, line, chars indented relative to root key)
    BadIndent(String, usize, usize),
    // Relays error back to a function which knowns the token.
    // InnerBadIndent(chars indented relative to root key)
    InnerBadIndent(usize),
    ColonBeforeKey,
    // FirstTokenMustBeKey(token as string)
    FirstTokenMustBeKey(String),
    // IncompleteCommentOrkey(token as string)
    IncompleteCommentOrKey(String, Line),
    // IncompleteLine(token as string)
    IncompleteLine(String, Line),
    // NoColonAfterKey(token as string)
    NoColonAfterKey(String),
    // Occurs if the top key of the keytree is different from the search segment.
    // BadFirstSegment(token, pos, key path)
    BadFirstSegment(String, String, String),
    // Occurs if a token other than the root token has zero indent.
    // NonRootNoIndent(token, line)
    NonRootNoIndent(String, Line),
    NoSpaceAfterKey,
    NoTokens,
    EmptyPath,
    [5.37431]
    [5.38892]
    pub fn expected_key_found_keyvalue() -> Error {
    Error(String::from("[01] Expected [key:] but found [key: value]."))
  • replacement in src/error.rs at line 22
    [5.38895][5.38895:39071]()
    // Equal if they are the same kind.
    impl PartialEq for ErrorKind {
    fn eq(&self, other: &Self) -> bool {
    mem::discriminant(self) == mem::discriminant(other)
    }
    [5.38895]
    [5.39071]
    pub fn expected_keyvalue_found_key() -> Error {
    Error(String::from("[02] Expected [key: value] but found [key:]."))
  • replacement in src/error.rs at line 26
    [5.39074][5.39074:39185](),[5.39185][5.5645:5706](),[5.5706][5.39185:39307](),[5.39185][5.39185:39307](),[5.39307][5.5707:5768](),[5.5768][5.39368:39429](),[5.39368][5.39368:39429](),[5.39429][5.1447:1508](),[5.1508][5.39490:39612](),[5.39490][5.39490:39612](),[5.39612][5.6291:6352](),[5.6352][5.39673:39856](),[5.39673][5.39673:39856](),[5.39856][5.279:340](),[5.340][3.406:467](),[3.467][5.39978:40365](),[5.39978][5.39978:40365]()
    impl StdError for Error {
    fn source(&self) -> Option<&(dyn StdError + 'static)> {
    match *self.0 {
    ErrorKind::User(_) => None,
    ErrorKind::EKeyFKeyValue => None,
    ErrorKind::EKeyValueFKey => None,
    ErrorKind::EUniqueKeyValueFMany(_,_) => None,
    ErrorKind::EUniqueTokenFMany => None,
    ErrorKind::FromStr(_, _) => None,
    ErrorKind::NoChildWithSegment(_, _, _) => None,
    ErrorKind::EmptyString => None,
    ErrorKind::BadIndent(_, _, _) => None,
    ErrorKind::InnerBadIndent(_) => None,
    ErrorKind::ColonBeforeKey => None,
    ErrorKind::FirstTokenMustBeKey(_) => None,
    ErrorKind::IncompleteCommentOrKey(_, _) => None,
    ErrorKind::IncompleteLine(_, _) => None,
    ErrorKind::NoColonAfterKey(_) => None,
    ErrorKind::BadFirstSegment(_, _, _) => None,
    ErrorKind::NonRootNoIndent(_, _) => None,
    ErrorKind::NoSpaceAfterKey => None,
    ErrorKind::NoTokens => None,
    ErrorKind::EmptyPath => None,
    }
    }
    [5.39074]
    [5.40365]
    pub fn expected_unique_found_multi(token: &Token, pos: usize) -> Error {
    Error(
    format!(
    "[03] Line {}, token {}. Expected unique token but found multiple tokens.",
    pos,
    token.to_string(),
    )
    )
  • replacement in src/error.rs at line 36
    [5.40368][5.40368:40486](),[5.40486][5.5769:5966](),[5.5966][5.1509:1557](),[5.1557][5.6031:6078](),[5.6031][5.6031:6078](),[5.6078][5.1558:1626](),[5.1626][5.6189:6275](),[5.6189][5.6189:6275](),[5.6275][5.40486:40731](),[5.40486][5.40486:40731](),[5.40731][5.6276:6562](),[5.6562][5.40852:41005](),[5.40852][5.40852:41005](),[5.41315][5.41315:41931](),[5.41931][5.6353:6412](),[5.6412][5.41984:42010](),[5.41984][5.41984:42010](),[5.42010][5.6413:6540](),[5.6540][5.42104:42740](),[5.42104][5.42104:42740](),[5.42740][5.341:597](),[5.597][5.42873:42889](),[5.42873][5.42873:42889](),[5.42889][3.468:627](),[3.627][5.43015:43042](),[5.43015][5.43015:43042](),[5.43042][3.628:654](),[3.654][5.43042:43075](),[5.43042][5.43042:43075]()
    impl fmt::Display for Error {
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
    match &*self.0 {
    ErrorKind::User(msg) => {
    write!(
    f,
    "Error: Client error: \"{}\".",
    msg,
    )
    }
    ErrorKind::FromStr(token, pos) => {
    write!(
    f,
    "Error: Couldn't parse string at {}: \"{}\".",
    pos,
    token,
    )
    },
    ErrorKind::EKeyFKeyValue => {
    write!(f, "{}", "expected_key_found_key_value")
    },
    ErrorKind::EKeyValueFKey => {
    write!(f, "{}", "expected_key_value_found_key")
    },
    ErrorKind::EUniqueKeyValueFMany(token, pos) => {
    write!(
    f,
    "token: {}, pos: {}",
    token,
    pos,
    )
    // "expected_unique_key_value_found_many")
    },
    ErrorKind::EUniqueTokenFMany => {
    write!(f, "{}", "expected_unique_token_found_many")
    },
    ErrorKind::NoChildWithSegment(token, line, child) => {
    write!(
    f,
    "Error: Tried to follow child segment \"{}\" but found line {}: \"{}\".",
    child,
    line,
    token,
    )
    },
    ErrorKind::BadFirstSegment(token, line, path) => {
    write!(f,
    "Err: Tried to follow segment \"{}\" but found line {}: \"{}\".",
    path,
    line,
    token,
    )
    },
    ErrorKind::BadIndent(token, line, indent) => {
    write!(f,
    "Indent of \"{}: {}\" on relative to root key is {} but must be multiple of 4.",
    line,
    token,
    indent
    )
    },
    // ErrorKind::Bincode(ref err) => Some(err),
    ErrorKind::EmptyString => {
    write!(f, "{}", "String is empty.")
    },
    ErrorKind::InnerBadIndent(_) => {
    write!(f, "bug")
    },
    ErrorKind::ColonBeforeKey => {
    write!(f, "{}", "colon before key")
    },
    ErrorKind::FirstTokenMustBeKey(token) => {
    write!(f, "Expected first token to be key but was \"{}\"", token)
    },
    ErrorKind::IncompleteCommentOrKey(token, line) => {
    write!(
    f,
    "\"{}\" at line {} is an incomplete comment or key.",
    token,
    line,
    )
    },
    ErrorKind::IncompleteLine(token, line) => {
    write!(
    f,
    "\"{}\" at line {} is incomplete.",
    token,
    line,
    )
    },
    [5.40368]
    [5.43075]
    pub fn expected_unique_token_found_multi() -> Error {
    Error(
    String::from("[04] Expected a unique token but found multiple.")
    )
    }
  • replacement in src/error.rs at line 42
    [5.43076][5.43076:43212]()
    ErrorKind::NoColonAfterKey(token) => {
    write!(f, "Expected a colon after key \"{}\"", token)
    },
    [5.43076]
    [5.43212]
    pub fn failed_to_parse_value(token: &Token, pos: usize) -> Error {
    Error(
    format!(
    "[05] Line {}, token {}. Failed to parse value.",
    pos,
    token.to_string(),
    )
    )
    }
  • replacement in src/error.rs at line 52
    [5.43213][5.43213:43461]()
    ErrorKind::NonRootNoIndent(token, line) => {
    write!(
    f,
    "\"{}\" at line {} has zero indent.",
    token,
    line,
    )
    },
    [5.43213]
    [5.43461]
    pub fn no_child_with_segment(a: &str, b: &str, c: &str) -> Error {
    Error(
    format!(
    "[06]"
    )
    )
    }
  • replacement in src/error.rs at line 60
    [5.43462][5.43462:43584]()
    ErrorKind::NoSpaceAfterKey => {
    write!(f, "{}", "no space after key")
    },
    [5.43462]
    [5.43584]
    pub fn empty_string() -> Error {
    Error(String::from("String is empty."))
    }
  • replacement in src/error.rs at line 64
    [5.43585][5.43585:43698]()
    ErrorKind::NoTokens => {
    write!(f, "{}", "no tokens")
    },
    [5.43585]
    [5.43698]
    pub fn bad_indent(token: &Token, pos: usize, indent: usize) -> Error {
    Error(
    format!(
    "[07] Line {}, token {}. Indentation of {} is incorrect.",
    line,
    pos,
    indent,
    )
    )
    }
  • edit in src/error.rs at line 75
    [5.43699][5.43699:43813]()
    ErrorKind::EmptyPath => {
    write!(f, "{}", "empty path")
    },
  • replacement in src/error.rs at line 76
    [5.43814][5.43814:43830]()
    }
    }
    [5.43814]
    [5.43830]
    pub fn colon_before_key() -> Error {
    Error(String::from("Colon before key."))
  • replacement in src/error.rs at line 80
    [5.43833][5.43833:43944]()
    #[cfg(test)]
    mod test {
    use super::*;
    use crate::{KeyTree, KeyTreeRef};
    use std::convert::TryInto;
    [5.43833]
    [5.43944]
    pub fn first_token_must_be_key(token: &Token) -> Error {
    Error(String::from("First token must be [key:]."
    }
  • edit in src/error.rs at line 84
    [5.43945]
    [5.43945]
    pub fn incomplete_comment_or_key(token: &Token, line: usize) -> Error {
    Error(String::from("Incomplete comment or key."))
    }
  • replacement in src/error.rs at line 88
    [5.43946][5.43946:44298]()
    #[test]
    fn is_empty() {
    assert_eq!(
    KeyTree::parse("")
    .expect_err("")
    .kind(),
    ErrorKind::EmptyString,
    );
    assert_eq!(
    KeyTree::parse("")
    .expect_err("")
    .to_string(),
    "String is empty."
    );
    }
    [5.43946]
    [5.44298]
    pub fn incomplete_line(token: &Token, line: usize) -> Error {
    Error(String::from("Incomplete line."))
    }
  • replacement in src/error.rs at line 92
    [5.44299][5.44299:44550]()
    #[test]
    fn first_token_is_kv() {
    assert_eq!(
    KeyTree::parse("key1: value")
    .expect_err("")
    .to_string(),
    "Expected first token to be key but was \"key1: value\"",
    )
    }
    [5.44299]
    [5.44550]
    pub fn no_colon_after_key(token: &Token) -> Error {
    Error(String::from("No colon after key.")
    }
  • replacement in src/error.rs at line 96
    [5.44551][5.44551:44953](),[5.44953][2.165:229]()
    #[test]
    fn colon_before_key() {
    assert_eq!(
    KeyTree::parse("key1:\n :key2")
    .expect_err("")
    .kind(),
    ErrorKind::ColonBeforeKey,
    )
    }
    #[test]
    fn incomplete_comment_or_key() {
    assert_eq!(
    KeyTree::parse("key:\n / text")
    .expect_err("")
    .to_string(),
    "\"/\" at line 2 is an incomplete comment or key.",
    [5.44551]
    [5.45006]
    pub fn bad_first_segment(token: &Token, pos: usize, key_path: &KeyPath) -> Error {
    Error(
    format!(
    "Bad first segment"
  • replacement in src/error.rs at line 101
    [5.45016][2.230:349](),[2.349][5.45016:45022](),[5.45016][5.45016:45022]()
    }
    #[test]
    fn indented_comment_parses() {
    assert!(KeyTree::parse("key:\n // comment").is_ok());
    }
    [5.45016]
    [2.350]
    }
  • replacement in src/error.rs at line 103
    [2.351][2.351:469](),[2.469][5.45022:45248](),[5.45022][5.45022:45248]()
    #[test]
    fn non_indented_comment_parses() {
    assert!(KeyTree::parse("key:\n// comment").is_ok());
    }
    #[test]
    fn line_finishes_in_key() {
    assert_eq!(
    KeyTree::parse("key\n")
    .expect_err("")
    .to_string(),
    "Line \"key\" is incomplete.",
    )
    }
    [2.351]
    [5.45248]
    pub fn non_root_has_zero_indent(token: &Token line: usize) -> Error {
    Error(String::from("Token other than root token as zero indent."))
    }
  • replacement in src/error.rs at line 107
    [5.45249][5.45249:45418](),[5.45418][2.470:534](),[2.534][5.45471:46474](),[5.45471][5.45471:46474](),[5.46474][5.1627:1708](),[5.1708][5.46561:47289](),[5.46561][5.46561:47289]()
    #[test]
    fn line_finishes_after_slash() {
    assert_eq!(
    KeyTree::parse("key:\n/")
    .expect_err("")
    .to_string(),
    "\"/\" at line 1 is an incomplete comment or key.",
    )
    }
    #[test]
    fn no_colon_after_key() {
    assert_eq!(
    KeyTree::parse("key1:\n key2 value")
    .expect_err("")
    .to_string(),
    "Expected a colon after key \"key2\"",
    )
    }
    #[test]
    fn no_space_after_key() {
    assert_eq!(
    KeyTree::parse("key1:\n key2:value")
    .expect_err("")
    .kind(),
    ErrorKind::NoSpaceAfterKey,
    )
    }
    #[derive(Debug)]
    struct TestU32(u32);
    impl<'a> TryInto<TestU32> for KeyTreeRef<'a> {
    type Error = Error;
    fn try_into(self) -> Result<TestU32, Error> {
    Ok(TestU32(self.at("key::val")?))
    }
    }
    #[test]
    fn expected_u32() {
    let kt = KeyTree::parse("key:\n val: abc").unwrap();
    let t: Result<TestU32, Error> = kt.to_ref().try_into();
    if let Err(err) = t {
    assert_eq!(
    err.kind(),
    ErrorKind::FromStr(String::new(), String::new(), String::new()),
    )
    } else {
    assert!(false)
    }
    }
    #[test]
    fn expected_kv() {
    let kt = KeyTree::parse("key:\n val:").unwrap();
    let t: Result<TestU32, Error> = kt.to_ref().try_into();
    if let Err(err) = t {
    assert_eq!(
    err.kind(),
    ErrorKind::EKeyValueFKey
    )
    } else {
    assert!(false)
    };
    }
    #[test]
    fn bad_indent() {
    assert_eq!(
    KeyTree::parse("key:\n key1: val") // 5 spaces
    .expect_err("")
    .to_string(),
    "Indent of \"key1: val\" relative to root key is 5 but must be multiple of 4.",
    )
    }
    [5.45249]
    [5.47289]
    pub fn no_space_after_key() -> Error {
    Error(String::from("No space after key."))
    }
  • replacement in src/error.rs at line 111
    [5.47290][5.47290:47727]()
    // Try to properly handle hard to debug errors.
    // This fails with:
    // "thread 'test::same_indent' panicked at 'attempt to subtract with overflow', src/parser.rs:132:53"
    //
    # [test]
    fn same_indent() {
    assert_eq!(
    KeyTree::parse("key1:\nkey2: val1")
    .expect_err("")
    .to_string(),
    "\"key2: val1\" at line 2 has zero indent.",
    )
    }
    [5.47290]
    [5.47727]
    pub fn no_tokens() -> Error {
    Error(String::from("No tokens."))
  • edit in src/error.rs at line 115
    [5.47730]
    pub fn empty_path() -> Error {
    Error(String::from("Empty path."))
    }