Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/C/Firefox/third_party/rust/basic-toml/tests/   (Firefox Browser Version 136.0.1©)  Datei vom 10.2.2025 mit Größe 3 kB image not shown  

Quelle  datetime.rs

  Sprache: 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"
    );
}

Messung V0.5 in Prozent
C=80 H=96 G=88

¤ Dauer der Verarbeitung: 0.12 Sekunden  (vorverarbeitet am  2026-06-18) ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

PVS Prover

Isabelle Prover

NIST Cobol Testsuite

Cephes Mathematical Library

Vienna Development Method

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.