Skip to content

Commit

Permalink
Make integration test a unit test
Browse files Browse the repository at this point in the history
I don't know why I implemented it as an integration test.
  • Loading branch information
Ortham committed Jan 19, 2025
1 parent 94d663b commit 18150b7
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 64 deletions.
20 changes: 8 additions & 12 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,25 +48,23 @@ jobs:
- name: Prepare test resources
shell: bash
run: |
cd tests
mkdir tests
curl -sSfLO 'https://github.com/Ortham/testing-plugins/archive/1.4.0.zip'
7z x 1.4.0.zip
mv testing-plugins-1.4.0 testing-plugins
mv testing-plugins-1.4.0 tests/testing-plugins
curl -sSfLO 'https://github.com/loot/libloot/releases/download/0.18.2/libloot-0.18.2-0-gb1a9e31_0.18.2-win32.7z'
7z x libloot-0.18.2-0-gb1a9e31_0.18.2-win32.7z
mv libloot-0.18.2-0-gb1a9e31_0.18.2-win32 libloot_win32
mv libloot-0.18.2-0-gb1a9e31_0.18.2-win32 tests/libloot_win32
curl -sSfLO 'https://github.com/loot/libloot/releases/download/0.18.2/libloot-0.18.2-0-gb1a9e31_0.18.2-win64.7z'
7z x libloot-0.18.2-0-gb1a9e31_0.18.2-win64.7z
mv libloot-0.18.2-0-gb1a9e31_0.18.2-win64 libloot_win64
mv libloot-0.18.2-0-gb1a9e31_0.18.2-win64 tests/libloot_win64
curl -sSfLO 'https://github.com/loot/loot-api-python/releases/download/4.0.2/loot_api_python-4.0.2-0-gd356ac2_master-python2.7-win32.7z'
7z x loot_api_python-4.0.2-0-gd356ac2_master-python2.7-win32.7z
mv loot_api_python-4.0.2-0-gd356ac2_master-python2.7-win32 loot_api_python
cd ..
mv loot_api_python-4.0.2-0-gd356ac2_master-python2.7-win32 tests/loot_api_python
- name: Build and run tests
run: cargo test --workspace
Expand All @@ -91,8 +89,6 @@ jobs:
- name: Build and run C++ tests
shell: bash
run: |
mkdir ffi/build
cd ffi/build
cmake ..
cmake --build .
ctest
cmake cmake -B ffi/build ffi
cmake --build ffi/build
ctest --test-dir ffi/build
26 changes: 26 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -406,6 +406,32 @@ mod tests {
);
}

#[test]
fn expression_parsing_should_ignore_whitespace_between_function_arguments() {
let is_ok = |s: &str| Expression::from_str(s).is_ok();

assert!(is_ok("version(\"Cargo.toml\", \"1.2\", ==)"));
assert!(is_ok(
"version(\"Unofficial Oblivion Patch.esp\",\"3.4.0\",>=)"
));
assert!(is_ok(
"version(\"Unofficial Skyrim Patch.esp\", \"2.0\", >=)"
));
assert!(is_ok("version(\"..\\TESV.exe\", \"1.8\", >) and not checksum(\"EternalShineArmorAndWeapons.esp\",3E85A943)"));
assert!(is_ok("version(\"..\\TESV.exe\",\"1.8\",>) and not checksum(\"EternalShineArmorAndWeapons.esp\",3E85A943)"));
assert!(is_ok("checksum(\"HM_HotkeyMod.esp\",374C564C)"));
assert!(is_ok("checksum(\"HM_HotkeyMod.esp\",CF00AFFD)"));
assert!(is_ok(
"checksum(\"HM_HotkeyMod.esp\",374C564C) or checksum(\"HM_HotkeyMod.esp\",CF00AFFD)"
));
assert!(is_ok("( checksum(\"HM_HotkeyMod.esp\",374C564C) or checksum(\"HM_HotkeyMod.esp\",CF00AFFD) )"));
assert!(is_ok("file(\"UFO - Ultimate Follower Overhaul.esp\")"));
assert!(is_ok("( checksum(\"HM_HotkeyMod.esp\",374C564C) or checksum(\"HM_HotkeyMod.esp\",CF00AFFD) ) and file(\"UFO - Ultimate Follower Overhaul.esp\")"));
assert!(is_ok(
"many(\"Deeper Thoughts (\\(Curie\\)|- (Expressive )?Curie)\\.esp\")"
));
}

#[test]
fn compound_condition_parse_should_handle_a_single_condition() {
let result = CompoundCondition::parse("file(\"Cargo.toml\")").unwrap().1;
Expand Down
52 changes: 0 additions & 52 deletions tests/parsing.rs

This file was deleted.

0 comments on commit 18150b7

Please sign in to comment.