diff options
author | Robin Krahl <robin.krahl@ireas.org> | 2019-01-08 02:55:11 +0000 |
---|---|---|
committer | Robin Krahl <robin.krahl@ireas.org> | 2019-01-08 04:54:14 +0100 |
commit | 1c76a540d647f351e27498e6f2135ff404853693 (patch) | |
tree | 0ad7877f445e396d8d3043f75b52aa18dccd4eec | |
parent | 9fc28c2099b50484a4b3154f64f764904d57334e (diff) | |
download | dialog-rs-1c76a540d647f351e27498e6f2135ff404853693.tar.gz dialog-rs-1c76a540d647f351e27498e6f2135ff404853693.tar.bz2 |
Move tests/ to examples/
So far it is hard to write unit tests for this crate as we don’t have
much logic. The existing tests are usage examples, therefore they are
moved to the examples directory. They can be run with `cargo run
--example <name>`.
-rw-r--r-- | examples/backend-dialog.rs (renamed from tests/dialog.rs) | 19 | ||||
-rw-r--r-- | examples/message.rs (renamed from tests/message.rs) | 8 |
2 files changed, 8 insertions, 19 deletions
diff --git a/tests/dialog.rs b/examples/backend-dialog.rs index 4c671f8..b6be492 100644 --- a/tests/dialog.rs +++ b/examples/backend-dialog.rs @@ -6,28 +6,21 @@ use std::io::Result; use dialog::backends; use dialog::DialogBox; -#[test] -fn message() -> Result<()> { +fn main() -> Result<()> { + let mut backend = backends::Dialog::new(); + dialog::Message::new("This is a message.") .title("And this is a title:") - .show_with(&backends::Dialog::new()) -} + .show_with(&backend)?; -#[test] -fn backtitle() -> Result<()> { - let mut backend = backends::Dialog::new(); backend.set_backtitle("Backtitle"); dialog::Message::new("This is a message.") .title("And this is a title:") - .show_with(&backend) -} + .show_with(&backend)?; -#[test] -fn size() -> Result<()> { - let mut backend = backends::Dialog::new(); backend.set_width(100); backend.set_height(10); - dialog::Message::new("This is a message.") + dialog::Message::new("This is a message with a fixed size.") .title("And this is a title:") .show_with(&backend) } diff --git a/tests/message.rs b/examples/message.rs index 4b1f18c..a72ef00 100644 --- a/tests/message.rs +++ b/examples/message.rs @@ -5,13 +5,9 @@ use std::io::Result; use dialog::DialogBox; -#[test] -fn text() -> Result<()> { - dialog::Message::new("This is a message.").show() -} +fn main() -> Result<()> { + dialog::Message::new("This is a message.").show()?; -#[test] -fn text_title() -> Result<()> { dialog::Message::new("This is a message.") .title("And this is a title:") .show() |