Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/C/Firefox/third_party/rust/ron/tests/   (Firefox Browser Version 136.0.1©)  Datei vom 10.2.2025 mit Größe 828 B image not shown  

Quelle  462_bytes.rs

  Sprache: Rust
 

#[test]
fn test_deserialise_byte_slice() {
    let val: &[u8] = &[0_u8, 1_u8, 2_u8, 3_u8];
    let ron = ron::to_string(val).unwrap();
    assert_eq!(ron, "[0,1,2,3]");

    // deserialising a byte slice from a byte sequence should fail
    //  with the error that a borrowed slice was expected but a byte
    //  buffer was provided
    // NOT with an expected string error, since the byte slice
    //  serialisation never serialises to a string
    assert_eq!(
        ron::from_str::<&[u8]>(&ron),
        Err(ron::error::SpannedError {
            code: ron::error::Error::InvalidValueForType {
                expected: String::from("a borrowed byte array"),
                found: String::from("the bytes \"AAECAw==\""),
            },
            position: ron::error::Position { line: 1, col: 10 },
        })
    );
}

Messung V0.5 in Prozent
C=78 H=100 G=89

¤ Dauer der Verarbeitung: 0.8 Sekunden  (vorverarbeitet am  2026-06-21) ¤

*© 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.