Skip to content

Commit

Permalink
fix: properly handle other field in LanguageMsg
Browse files Browse the repository at this point in the history
Change type of `other` field in the `LanguageMsg` type from `String` to
`Option<String>` because it is not always present.
  • Loading branch information
indiv0 committed Dec 16, 2016
1 parent f8dd9c9 commit 19b71bf
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/model.in.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ pub struct DidYouMean {
pub struct LanguageMsg {
// Attributes
pub english: String,
pub other: String,
pub other: Option<String>,
}

/// Provides information for queries regarding a topic under development.
Expand Down
6 changes: 6 additions & 0 deletions src/model.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ mod tests {
DidYouMeans,
Img,
Infos,
LanguageMsg,
Plaintext,
Pod,
QueryResult,
Expand Down Expand Up @@ -68,6 +69,11 @@ mod tests {
from_str::<QueryResult>(&read_sample_data_from_path("tests/sample-data/query_result_6.xml")).unwrap();
}

#[test]
fn test_languagemsg_deserializer() {
from_str::<LanguageMsg>(&read_sample_data_from_path("tests/sample-data/languagemsg.xml")).unwrap();
}

#[test]
fn test_definitions_deserializer() {
from_str::<Definitions>(&read_sample_data_from_path("tests/sample-data/definitions.xml")).unwrap();
Expand Down
1 change: 1 addition & 0 deletions tests/sample-data/languagemsg.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<languagemsg english='Wolfram|Alpha does not yet support Slovak.' />

0 comments on commit 19b71bf

Please sign in to comment.