aboutsummaryrefslogtreecommitdiffhomepage
path: root/examples/rust/hello_lib/src/greeter.rs
diff options
context:
space:
mode:
Diffstat (limited to 'examples/rust/hello_lib/src/greeter.rs')
-rw-r--r--examples/rust/hello_lib/src/greeter.rs11
1 files changed, 11 insertions, 0 deletions
diff --git a/examples/rust/hello_lib/src/greeter.rs b/examples/rust/hello_lib/src/greeter.rs
index 2a7d7153b9..bf332e4bd1 100644
--- a/examples/rust/hello_lib/src/greeter.rs
+++ b/examples/rust/hello_lib/src/greeter.rs
@@ -60,3 +60,14 @@ impl Greeter {
println!("{} {}", &self.greeting, thing);
}
}
+
+#[cfg(test)]
+mod test {
+ use super::Greeter;
+
+ #[test]
+ fn test_greeting() {
+ let hello = Greeter::new("Hi");
+ assert_eq!("Hi Rust", hello.greeting("Rust"));
+ }
+}