• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 use std::path::Path;
2 
3 #[test]
version_cmp()4 fn version_cmp() {
5     use super::version::Version;
6     let v123 = Version::new(1, 2, 3);
7 
8     assert!(Version::new(1, 0, 0) < v123);
9     assert!(Version::new(1, 2, 2) < v123);
10     assert!(Version::new(1, 2, 3) == v123);
11     assert!(Version::new(1, 2, 4) > v123);
12     assert!(Version::new(1, 10, 0) > v123);
13     assert!(Version::new(2, 0, 0) > v123);
14 }
15 
16 #[test]
dir_does_not_contain_target()17 fn dir_does_not_contain_target() {
18     assert!(!super::dir_contains_target(
19         &Some("x86_64-unknown-linux-gnu".into()),
20         Path::new("/project/target/debug/build/project-ea75983148559682/out"),
21         None,
22     ));
23 }
24 
25 #[test]
dir_does_contain_target()26 fn dir_does_contain_target() {
27     assert!(super::dir_contains_target(
28         &Some("x86_64-unknown-linux-gnu".into()),
29         Path::new(
30             "/project/target/x86_64-unknown-linux-gnu/debug/build/project-0147aca016480b9d/out"
31         ),
32         None,
33     ));
34 }
35 
36 #[test]
dir_does_not_contain_target_with_custom_target_dir()37 fn dir_does_not_contain_target_with_custom_target_dir() {
38     assert!(!super::dir_contains_target(
39         &Some("x86_64-unknown-linux-gnu".into()),
40         Path::new("/project/custom/debug/build/project-ea75983148559682/out"),
41         Some("custom".into()),
42     ));
43 }
44 
45 #[test]
dir_does_contain_target_with_custom_target_dir()46 fn dir_does_contain_target_with_custom_target_dir() {
47     assert!(super::dir_contains_target(
48         &Some("x86_64-unknown-linux-gnu".into()),
49         Path::new(
50             "/project/custom/x86_64-unknown-linux-gnu/debug/build/project-0147aca016480b9d/out"
51         ),
52         Some("custom".into()),
53     ));
54 }
55