Create new post about unit testing

This commit is contained in:
Philipp Oppermann
2018-04-25 10:07:53 +02:00
parent d7efdf013a
commit 44ffa1d046
4 changed files with 493 additions and 5 deletions

View File

@@ -1,18 +1,25 @@
#![feature(lang_items)] // required for defining the panic handler
#![feature(const_fn)] // allow declaring functions as const
#![no_std] // don't link the Rust standard library
#![no_main] // disable all Rust-level entry points
#![cfg_attr(not(test), no_main)] // disable all Rust-level entry points
#![cfg_attr(test, allow(dead_code, unused_macros))] // allow unused code in test mode
extern crate spin;
extern crate volatile;
#[macro_use]
extern crate lazy_static;
#[cfg(test)]
extern crate array_init;
#[cfg(test)]
extern crate std;
#[macro_use]
mod vga_buffer;
/// This function is the entry point, since the linker looks for a function
/// named `_start_` by default.
#[cfg(not(test))]
#[no_mangle] // don't mangle the name of this function
pub extern "C" fn _start() -> ! {
println!("Hello World{}", "!");
@@ -21,6 +28,7 @@ pub extern "C" fn _start() -> ! {
}
/// This function is called on panic.
#[cfg(not(test))]
#[lang = "panic_fmt"]
#[no_mangle]
pub extern "C" fn rust_begin_panic(