Skip to content

Commit

Permalink
Fix panic on config file generation (#153)
Browse files Browse the repository at this point in the history
  • Loading branch information
czocher authored Aug 31, 2024
1 parent a905fc1 commit d75929a
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions cli/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,11 @@ pub struct ScalaParams {
#[serde(default)]
pub struct SwiftParams {
pub prefix: String,
pub type_mappings: HashMap<String, String>,
pub default_decorators: Vec<String>,
pub default_generic_constraints: Vec<String>,
/// The contraints to apply to `CodableVoid`.
pub codablevoid_constraints: Vec<String>,
pub type_mappings: HashMap<String, String>,
}

#[derive(Default, Serialize, Deserialize, PartialEq, Eq, Debug)]
Expand All @@ -49,8 +49,8 @@ pub struct TypeScriptParams {
#[cfg(feature = "go")]
pub struct GoParams {
pub package: String,
pub type_mappings: HashMap<String, String>,
pub uppercase_acronyms: Vec<String>,
pub type_mappings: HashMap<String, String>,
}

/// The paramters that are used to configure the behaviour of typeshare
Expand Down Expand Up @@ -126,6 +126,14 @@ mod test {
[CURRENT_DIR, TEST_DIR, filename].iter().collect()
}

#[test]
fn to_string_and_back() {
let path = config_file_path("mappings_config.toml");
let config = load_config(Some(path)).unwrap();

toml::from_str::<Config>(&toml::to_string_pretty(&config).unwrap()).unwrap();
}

#[test]
fn default_test() {
let path = config_file_path("default_config.toml");
Expand Down

0 comments on commit d75929a

Please sign in to comment.