forked from forge/build.rs
Some tests
This commit is contained in:
parent
d02aca6864
commit
603f040b97
23
src/db.rs
23
src/db.rs
|
@ -142,3 +142,26 @@ pub fn is_executable(path: &Path) -> bool {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
mod tests {
|
||||||
|
use super::*;
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn can_load_db() {
|
||||||
|
let base_dir = "tests/success";
|
||||||
|
let entries = from(base_dir, is_executable).expect("Could not load db");
|
||||||
|
let entries_names: Vec<String> = entries.iter().map(|x| x.name.clone().into_string().unwrap()).collect();
|
||||||
|
|
||||||
|
let expected: Vec<String> = vec!("task", "symlink", "no_source").iter().map(|x| x.to_string()).collect();
|
||||||
|
|
||||||
|
assert_eq!(expected.len(), entries_names.len());
|
||||||
|
|
||||||
|
for entry in expected {
|
||||||
|
if !entries_names.contains(&entry.to_string()) {
|
||||||
|
panic!("Could not find {}", &entry);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
echo "LOL sourceless task"
|
|
@ -0,0 +1 @@
|
||||||
|
../no_source
|
|
@ -0,0 +1 @@
|
||||||
|
../symlink
|
|
@ -0,0 +1 @@
|
||||||
|
../symlink.source
|
|
@ -0,0 +1 @@
|
||||||
|
../task
|
|
@ -0,0 +1 @@
|
||||||
|
../task.source
|
|
@ -0,0 +1 @@
|
||||||
|
task
|
|
@ -0,0 +1 @@
|
||||||
|
task.source
|
|
@ -0,0 +1,3 @@
|
||||||
|
#! /bin/bash
|
||||||
|
|
||||||
|
echo Hello
|
|
@ -0,0 +1 @@
|
||||||
|
https://tildegit.org/southerntofu/git-build.sh
|
|
@ -0,0 +1,3 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
echo "Ce script ne devrait jamais être exécuté"
|
|
@ -0,0 +1 @@
|
||||||
|
SDJSQKLDJQKLSDJQS
|
Loading…
Reference in New Issue