Fix datatests to be properly working in newer nightly rust
All checks were successful
continuous-integration/drone Build is passing
All checks were successful
continuous-integration/drone Build is passing
This commit is contained in:
24
tests/datatests/mod.rs
Normal file
24
tests/datatests/mod.rs
Normal file
@@ -0,0 +1,24 @@
|
||||
// This file is generated by build.rs
|
||||
|
||||
use std::path::Path;
|
||||
use std::fs::File;
|
||||
use std::io::Read;
|
||||
use super::common::TestCase;
|
||||
use super::get_library;
|
||||
|
||||
fn integration_tests(input: &Path) {
|
||||
let mut str: String = "".to_string();
|
||||
let mut file = File::open(input).unwrap();
|
||||
file.read_to_string(&mut str).unwrap();
|
||||
let test_case = serde_yaml::from_str::<TestCase>(&str).unwrap();
|
||||
println!(" Running integration test {}", test_case.name);
|
||||
test_case.run_test(get_library());
|
||||
}
|
||||
|
||||
|
||||
#[test]
|
||||
fn basic_single_turn() {
|
||||
integration_tests(Path::new("tests/test_cases/basic_single_turn.yaml"));
|
||||
}
|
||||
|
||||
|
||||
@@ -1,11 +1,6 @@
|
||||
#![feature(custom_test_frameworks)]
|
||||
#![feature(once_cell)]
|
||||
#![test_runner(datatest::runner)]
|
||||
#![allow(clippy::borrowed_box)]
|
||||
|
||||
use std::fs::File;
|
||||
use std::io::Read;
|
||||
use std::path::Path;
|
||||
use std::sync::Arc;
|
||||
|
||||
use pkmn_lib::dynamic_data::{
|
||||
@@ -13,9 +8,10 @@ use pkmn_lib::dynamic_data::{
|
||||
ScriptCategory, ScriptContainer, ScriptOwnerData, TurnChoice, VolatileScriptsOwner,
|
||||
};
|
||||
|
||||
use crate::common::{library_loader, TestCase};
|
||||
use crate::common::library_loader;
|
||||
|
||||
pub mod common;
|
||||
pub mod datatests;
|
||||
|
||||
fn get_library() -> Arc<dyn DynamicLibrary> {
|
||||
library_loader::load_library().library
|
||||
@@ -49,19 +45,6 @@ fn validate_library_load() {
|
||||
);
|
||||
}
|
||||
|
||||
#[datatest::files("tests/test_cases", {
|
||||
input in r"^(.*)\.yaml"
|
||||
})]
|
||||
#[cfg_attr(miri, ignore)]
|
||||
fn integration_tests(input: &Path) {
|
||||
let mut str: String = "".to_string();
|
||||
let mut file = File::open(input).unwrap();
|
||||
file.read_to_string(&mut str).unwrap();
|
||||
let test_case = serde_yaml::from_str::<TestCase>(&str).unwrap();
|
||||
println!("\tRunning integration test {}", test_case.name);
|
||||
test_case.run_test(get_library());
|
||||
}
|
||||
|
||||
/// Assurance has the interesting properties that it creates a special data script internally, and
|
||||
/// deletes that data script through the get_owner functionality.
|
||||
#[test]
|
||||
|
||||
Reference in New Issue
Block a user