mirror of
https://github.com/containers/youki
synced 2024-09-27 22:49:57 +02:00
introduce unit tests.
This commit is contained in:
parent
50dc7e42b1
commit
07ff66aadf
14
.github/workflows/main.yml
vendored
14
.github/workflows/main.yml
vendored
@ -7,7 +7,7 @@ on:
|
||||
- main
|
||||
|
||||
jobs:
|
||||
check:
|
||||
tests:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
@ -16,7 +16,11 @@ jobs:
|
||||
with:
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
args: --all-features
|
||||
test:
|
||||
- name: Build
|
||||
run: cargo build
|
||||
- name: Run tests
|
||||
run: cargo test
|
||||
integration_tests:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
@ -26,10 +30,6 @@ jobs:
|
||||
- uses: actions-rs/cargo@v1
|
||||
with:
|
||||
command: build
|
||||
- name: Print Rust Version
|
||||
run: |
|
||||
rustc -Vv
|
||||
cargo -Vv
|
||||
- uses: actions/setup-go@v2
|
||||
with:
|
||||
go-version: "1.11.0"
|
||||
@ -40,7 +40,7 @@ jobs:
|
||||
git clone https://github.com/opencontainers/runtime-tools
|
||||
cd runtime-tools
|
||||
make runtimetest validation-executables
|
||||
- name: Run intetgration test
|
||||
- name: Run intetgration tests
|
||||
run: |
|
||||
expect_err_num=8
|
||||
act_err_num=0
|
||||
|
25
src/utils.rs
25
src/utils.rs
@ -57,3 +57,28 @@ pub fn set_name(_name: &str) -> Result<()> {
|
||||
// }
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn test_join_absolute_path() {
|
||||
assert_eq!(
|
||||
PathBuf::from("sample/a/")
|
||||
.join_absolute_path(&PathBuf::from("/b"))
|
||||
.unwrap(),
|
||||
PathBuf::from("sample/a/b")
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_join_absolute_path_error() {
|
||||
assert_eq!(
|
||||
PathBuf::from("sample/a/")
|
||||
.join_absolute_path(&PathBuf::from("b/c"))
|
||||
.is_err(),
|
||||
true
|
||||
);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user