refactor: upgrade crates and restructure project
This commit is contained in:
1 parent
ea093c044f
commit
47dad69321
80 files changed
+6094
-6125
No files matched your search
+7
-22
@@ -2,7 +2,7 @@ use chrono::{DateTime, Utc};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use std::fmt;
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Serialize, Deserialize)]
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "snake_case")]
|
||||
pub enum ModLoader {
|
||||
Vanilla,
|
||||
@@ -43,15 +43,6 @@ pub struct InstanceConfig {
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn test_modloader_display() {
|
||||
assert_eq!(ModLoader::Vanilla.to_string(), "Vanilla");
|
||||
assert_eq!(ModLoader::Fabric.to_string(), "Fabric");
|
||||
assert_eq!(ModLoader::Forge.to_string(), "Forge");
|
||||
assert_eq!(ModLoader::NeoForge.to_string(), "NeoForge");
|
||||
assert_eq!(ModLoader::Quilt.to_string(), "Quilt");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_instance_config_roundtrip() {
|
||||
let config = InstanceConfig {
|
||||
@@ -67,17 +58,11 @@ mod tests {
|
||||
jvm_args: vec![],
|
||||
resolution: Some((1920, 1080)),
|
||||
};
|
||||
match serde_json::to_string_pretty(&config) {
|
||||
Ok(json) => match serde_json::from_str::<InstanceConfig>(&json) {
|
||||
Ok(parsed) => {
|
||||
assert_eq!(parsed.name, config.name);
|
||||
assert_eq!(parsed.game_version, config.game_version);
|
||||
assert_eq!(parsed.loader, config.loader);
|
||||
assert_eq!(parsed.resolution, config.resolution);
|
||||
}
|
||||
Err(e) => panic!("Deserialization failed: {}", e),
|
||||
},
|
||||
Err(e) => panic!("Serialization failed: {}", e),
|
||||
}
|
||||
let json = serde_json::to_string_pretty(&config).expect("serialize");
|
||||
let parsed: InstanceConfig = serde_json::from_str(&json).expect("deserialize");
|
||||
assert_eq!(parsed.name, config.name);
|
||||
assert_eq!(parsed.game_version, config.game_version);
|
||||
assert_eq!(parsed.loader, config.loader);
|
||||
assert_eq!(parsed.resolution, config.resolution);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user