-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add integration tests for simple mod lints
- Loading branch information
Showing
12 changed files
with
96 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# Test Mod Batches | ||
|
||
Each test mod batch can consist of one or more test mods. Each batch is intended to serve as the | ||
mods within a profile, so we can test various aspects of integration and linting. |
Binary file not shown.
Empty file.
Empty file.
Empty file.
Empty file.
Binary file not shown.
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
use std::path::PathBuf; | ||
use std::str::FromStr; | ||
|
||
use drg_mod_integration::mod_lint::ModLintReport; | ||
use drg_mod_integration::providers::ModSpecification; | ||
|
||
#[test] | ||
pub fn test_lint_conflicting_files() { | ||
let base_path = PathBuf::from_str("test_mod_batches/simple_lints/").unwrap(); | ||
assert!(base_path.exists()); | ||
let a_path = base_path.clone().join("A.pak"); | ||
assert!(a_path.exists()); | ||
let b_path = base_path.clone().join("B.pak"); | ||
assert!(b_path.exists()); | ||
let a_spec = ModSpecification { | ||
url: "A".to_string(), | ||
}; | ||
let b_spec = ModSpecification { | ||
url: "B".to_string(), | ||
}; | ||
let mods = vec![(a_spec.clone(), a_path), (b_spec.clone(), b_path)]; | ||
|
||
let ModLintReport { | ||
conflicting_mods, .. | ||
} = drg_mod_integration::mod_lint::lint(&mods).unwrap(); | ||
|
||
println!("{:#?}", conflicting_mods); | ||
|
||
assert_eq!( | ||
conflicting_mods.get("fsd/content/a.uexp"), | ||
Some(&[a_spec, b_spec].into()) | ||
); | ||
} | ||
|
||
#[test] | ||
pub fn test_lint_shader() { | ||
let base_path = PathBuf::from_str("test_mod_batches/simple_lints/").unwrap(); | ||
assert!(base_path.exists()); | ||
let a_path = base_path.clone().join("A.pak"); | ||
assert!(a_path.exists()); | ||
let b_path = base_path.clone().join("B.pak"); | ||
assert!(b_path.exists()); | ||
let a_spec = ModSpecification { | ||
url: "A".to_string(), | ||
}; | ||
let b_spec = ModSpecification { | ||
url: "B".to_string(), | ||
}; | ||
let mods = vec![(a_spec.clone(), a_path), (b_spec.clone(), b_path)]; | ||
|
||
let ModLintReport { | ||
shader_file_mods, .. | ||
} = drg_mod_integration::mod_lint::lint(&mods).unwrap(); | ||
|
||
println!("{:#?}", shader_file_mods); | ||
|
||
assert_eq!( | ||
shader_file_mods.get(&a_spec), | ||
Some(&["fsd/content/c.ushaderbytecode".to_string()].into()) | ||
); | ||
} | ||
|
||
#[test] | ||
pub fn test_lint_asset_registry_bin() { | ||
let base_path = PathBuf::from_str("test_mod_batches/simple_lints/").unwrap(); | ||
assert!(base_path.exists()); | ||
let a_path = base_path.clone().join("A.pak"); | ||
assert!(a_path.exists()); | ||
let b_path = base_path.clone().join("B.pak"); | ||
assert!(b_path.exists()); | ||
let a_spec = ModSpecification { | ||
url: "A".to_string(), | ||
}; | ||
let b_spec = ModSpecification { | ||
url: "B".to_string(), | ||
}; | ||
let mods = vec![(a_spec.clone(), a_path), (b_spec.clone(), b_path)]; | ||
|
||
let ModLintReport { | ||
asset_register_bin_mods, | ||
.. | ||
} = drg_mod_integration::mod_lint::lint(&mods).unwrap(); | ||
|
||
println!("{:#?}", asset_register_bin_mods); | ||
|
||
assert_eq!( | ||
asset_register_bin_mods.get(&a_spec), | ||
Some(&["fsd/content/assetregistry.bin".to_string()].into()) | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
mod conflicting; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
mod lint; |