hello_exercism/
lib.rs

1// Rust File: src/lib.rs
2pub fn hello() -> &'static str {
3    println!("{}", hallo());
4    "Hello, World!"
5}
6
7fn hallo() -> &'static str {
8    "Hallo, Welt!"
9}
10
11// BEGIN: unit tests for private code
12// code 1
13#[cfg(test)]
14#[path = "./private_tests/owned_hello.rs"]
15mod owned_hello;
16
17// code 2
18#[cfg(test)]
19#[path = "./private_tests/mod.rs"]
20mod private_tests;
21
22// code 3
23#[cfg(test)]
24mod private_tests_with_use {
25    use super::*;
26    //use super::hallo;
27
28    #[test]
29    fn it_works_at_private() {
30        assert_eq!("Hallo, Welt!", hallo());
31    }
32}
33
34// code 4
35#[cfg(test)]
36mod private_tests_without_use {
37    #[test]
38    fn it_works_at_private() {
39        assert_eq!("Hallo, Welt!", super::hallo());
40    }
41}
42// END unit tests for private code 
43
44// BEGIN: integration tests
45#[cfg(test)]
46#[path = "./integration_tests/i_hello.rs"]
47mod i_hello;
48
49#[cfg(test)]
50#[path = "./integration_tests/mod.rs"]
51mod integration_tests;
52// END: integration tests