LINK: ESTABLISHED
BOOTING PERSONAL TERMINAL...    LOADING USER PROFILE...    APPLYING CRT FILTERS...    PRESS [NAV] TO SWITCH SECTIONS    //    SELF-HOSTED AGGREGATE ANALYTICS ACTIVE.  
MODE: DESKTOP

briefings RusTorial


https://wieerwill.dev/talks/2402_rustorial
DATE 20/02/2024
TAGS DE • Rust • Tutorial • 20min

RusTorial

Let's get into the Rust Programming Language. We get from the very basics to first coding experience so you can start right away. Be aware, this talk was held in German.

RusTorial

Eine Einführung in Rust für Entwickler

Testing 2/2

Beispiel Test

#[cfg(test)]
mod tests {
  // Import the necessary modules
  use std::fs::OpenOptions;
  use std::io::Write;

  // This test writes to a file
  #[test]
  fn test_file() {
      // Opens the file ferris.txt or creates one if it doesn't exist.
      let mut file = OpenOptions::new()
          .append(true)
          .create(true)
          .open("ferris.txt")
          .expect("Failed to open ferris.txt");

      // Print "Ferris" 5 times.
      for _ in 0..5 {
          file.write_all("Ferris
".as_bytes())
              .expect("Could not write to ferris.txt");
      }
  }
}

END OF BRIEFING

End of record. Further disclosure requires clearance.