This repository has been archived on 2026-08-31. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
donglora/vendor/basic-toml/tests/datetime.rs
T
swaitsandClaude Opus 4.6 3102fc747a feat: add display UI with splash screen, dashboard, and RSSI sparkline
Implement full SSD1306 OLED display support:
- Splash screen on boot (1.5s) with project name, version, board
- Dashboard showing radio state, config, counters, RSSI/SNR
- RSSI history sparkline (64-sample ring buffer, 2px-wide bars)
- DisplayOn/DisplayOff host commands routed via dedicated channel
- Pure render functions against generic DrawTarget (no hardware coupling)
- Display on/off control bypasses radio task entirely

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-29 20:42:54 -06:00

143 lines
3.8 KiB
Rust

use serde_json::Value;
macro_rules! bad {
($toml:expr, $msg:expr) => {
match basic_toml::from_str::<Value>($toml) {
Ok(s) => panic!("parsed to: {:#?}", s),
Err(e) => assert_eq!(e.to_string(), $msg),
}
};
}
#[test]
fn times() {
fn multi_bad(s: &str, msg: &str) {
bad!(s, msg);
bad!(&s.replace('T', " "), msg);
bad!(&s.replace('T', "t"), msg);
bad!(&s.replace('Z', "z"), msg);
}
multi_bad(
"foo = 1997-09-09T09:09:09Z",
"invalid number at line 1 column 7",
);
multi_bad(
"foo = 1997-09-09T09:09:09+09:09",
"invalid number at line 1 column 7",
);
multi_bad(
"foo = 1997-09-09T09:09:09-09:09",
"invalid number at line 1 column 7",
);
multi_bad(
"foo = 1997-09-09T09:09:09",
"invalid number at line 1 column 7",
);
multi_bad("foo = 1997-09-09", "invalid number at line 1 column 7");
bad!("foo = 1997-09-09 ", "invalid number at line 1 column 7");
bad!(
"foo = 1997-09-09 # comment",
"invalid number at line 1 column 7"
);
multi_bad("foo = 09:09:09", "invalid number at line 1 column 8");
multi_bad(
"foo = 1997-09-09T09:09:09.09Z",
"invalid number at line 1 column 7",
);
multi_bad(
"foo = 1997-09-09T09:09:09.09+09:09",
"invalid number at line 1 column 7",
);
multi_bad(
"foo = 1997-09-09T09:09:09.09-09:09",
"invalid number at line 1 column 7",
);
multi_bad(
"foo = 1997-09-09T09:09:09.09",
"invalid number at line 1 column 7",
);
multi_bad("foo = 09:09:09.09", "invalid number at line 1 column 8");
}
#[test]
fn bad_times() {
bad!("foo = 199-09-09", "invalid number at line 1 column 7");
bad!("foo = 199709-09", "invalid number at line 1 column 7");
bad!("foo = 1997-9-09", "invalid number at line 1 column 7");
bad!("foo = 1997-09-9", "invalid number at line 1 column 7");
bad!(
"foo = 1997-09-0909:09:09",
"invalid number at line 1 column 7"
);
bad!(
"foo = 1997-09-09T09:09:09.",
"invalid number at line 1 column 7"
);
bad!(
"foo = T",
"invalid TOML value, did you mean to use a quoted string? at line 1 column 7"
);
bad!(
"foo = T.",
"invalid TOML value, did you mean to use a quoted string? at line 1 column 7"
);
bad!(
"foo = TZ",
"invalid TOML value, did you mean to use a quoted string? at line 1 column 7"
);
bad!(
"foo = 1997-09-09T09:09:09.09+",
"invalid number at line 1 column 7"
);
bad!(
"foo = 1997-09-09T09:09:09.09+09",
"invalid number at line 1 column 7"
);
bad!(
"foo = 1997-09-09T09:09:09.09+09:9",
"invalid number at line 1 column 7"
);
bad!(
"foo = 1997-09-09T09:09:09.09+0909",
"invalid number at line 1 column 7"
);
bad!(
"foo = 1997-09-09T09:09:09.09-",
"invalid number at line 1 column 7"
);
bad!(
"foo = 1997-09-09T09:09:09.09-09",
"invalid number at line 1 column 7"
);
bad!(
"foo = 1997-09-09T09:09:09.09-09:9",
"invalid number at line 1 column 7"
);
bad!(
"foo = 1997-09-09T09:09:09.09-0909",
"invalid number at line 1 column 7"
);
bad!(
"foo = 1997-00-09T09:09:09.09Z",
"invalid number at line 1 column 7"
);
bad!(
"foo = 1997-09-00T09:09:09.09Z",
"invalid number at line 1 column 7"
);
bad!(
"foo = 1997-09-09T30:09:09.09Z",
"invalid number at line 1 column 7"
);
bad!(
"foo = 1997-09-09T12:69:09.09Z",
"invalid number at line 1 column 7"
);
bad!(
"foo = 1997-09-09T12:09:69.09Z",
"invalid number at line 1 column 7"
);
}