Skip to content

Commit

Permalink
Fix panic on config file generation
Browse files Browse the repository at this point in the history
  • Loading branch information
czocher committed Jan 30, 2024
1 parent c3ee2ad commit 5a25562
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 @@ -29,9 +29,9 @@ 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>,
pub type_mappings: HashMap<String, String>,
}

#[derive(Default, Serialize, Deserialize, PartialEq, Eq, Debug)]
Expand All @@ -45,8 +45,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 @@ -122,6 +122,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 5a25562

Please sign in to comment.