From 208104d036aaa517aa88106c290980db4f1282af Mon Sep 17 00:00:00 2001 From: Gwilym Kuiper Date: Sun, 3 Jul 2022 18:30:58 +0100 Subject: [PATCH] Update the template to have testing available --- template/Cargo.toml | 3 +++ template/src/main.rs | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/template/Cargo.toml b/template/Cargo.toml index 7ce1334f..fc99e68b 100644 --- a/template/Cargo.toml +++ b/template/Cargo.toml @@ -9,6 +9,9 @@ edition = "2018" [dependencies] agb = "0.9.2" +[dev-dependencies] +agb = { version = "0.9.2", features = ["testing"] } + [profile.release] panic = "abort" lto = true \ No newline at end of file diff --git a/template/src/main.rs b/template/src/main.rs index 1b6a9fd1..84683dc9 100644 --- a/template/src/main.rs +++ b/template/src/main.rs @@ -9,6 +9,10 @@ // using the #[agb::entry] proc macro. Failing to do so will cause failure in linking // which won't be a particularly clear error message. #![no_main] +// This is required to allow writing tests +#![cfg_attr(test, feature(custom_test_frameworks))] +#![cfg_attr(test, reexport_test_harness_main = "test_main")] +#![cfg_attr(test, test_runner(agb::test_runner::test_runner))] use agb::{display, syscall};