mirror of
https://github.com/emilybache/GildedRose-Refactoring-Kata.git
synced 2025-12-12 20:32:15 +00:00
Risky: Move tests into mod.rs
Usual Rust practice is to put tests in the same file they are testing. I don't see any magic in the texttests that would require tests and code to be in separate files, but I am not entirely sure, so I added the risky tag.
This commit is contained in:
parent
2a53bf5db5
commit
87f3e536a4
@ -78,4 +78,15 @@ impl GildedRose {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod test;
|
mod tests {
|
||||||
|
use super::{GildedRose, Item};
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
pub fn foo() {
|
||||||
|
let items = vec![Item::new(String::from("foo"), 0, 0)];
|
||||||
|
let mut rose = GildedRose::new(items);
|
||||||
|
rose.update_quality();
|
||||||
|
|
||||||
|
assert_eq!("fixme", rose.items[0].name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@ -1,10 +0,0 @@
|
|||||||
use super::{GildedRose, Item};
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
pub fn foo() {
|
|
||||||
let items = vec![Item::new(String::from("foo"), 0, 0)];
|
|
||||||
let mut rose = GildedRose::new(items);
|
|
||||||
rose.update_quality();
|
|
||||||
|
|
||||||
assert_eq!("fixme", rose.items[0].name);
|
|
||||||
}
|
|
||||||
Loading…
Reference in New Issue
Block a user