Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/C/Firefox/third_party/rust/tokio/tests/   (Firefox Browser Version 153.0.1©)  Datei vom 27.6.2026 mit Größe 899 B image not shown  

Quelle  fs.rs

  Sprache: Rust
 

#![warn(rust_2018_idioms)]
#![cfg(all(feature = "full", not(target_os = "wasi")))] // Wasi does not support file operations

use tokio::fs;
use tokio_test::assert_ok;

#[tokio::test]
async fn path_read_write() {
    let temp = tempdir();
    let dir = temp.path();

    assert_ok!(fs::write(dir.join("bar"), b"bytes").await);
    let out = assert_ok!(fs::read(dir.join("bar")).await);

    assert_eq!(out, b"bytes");
}

#[tokio::test]
async fn try_clone_should_preserve_max_buf_size() {
    let buf_size = 128;
    let temp = tempdir();
    let dir = temp.path();

    let mut file = fs::File::create(dir.join("try_clone_should_preserve_max_buf_size"))
        .await
        .unwrap();
    file.set_max_buf_size(buf_size);

    let cloned = file.try_clone().await.unwrap();

    assert_eq!(cloned.max_buf_size(), buf_size);
}

fn tempdir() -> tempfile::TempDir {
    tempfile::tempdir().unwrap()
}

Messung V0.5 in Prozent
C=95 H=93 G=93

¤ Dauer der Verarbeitung: 0.4 Sekunden  ¤

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