Skip to content

Commit

Permalink
Merge pull request #15 from ctron/feature/fix_lang_1
Browse files Browse the repository at this point in the history
fix: language is set to product field
  • Loading branch information
KenDJohnson authored Sep 6, 2024
2 parents 4ae6bbe + c3c05e6 commit 0b99032
Showing 1 changed file with 23 additions and 1 deletion.
24 changes: 23 additions & 1 deletion src/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -144,8 +144,30 @@ impl<'a> CpeBuilder<'a, Uri<'a>> {
add_field!(version, set_version);
add_field!(update, set_update);
add_field!(edition, set_edition);
add_field!(language, set_product);
add_field!(language, set_language);

Ok(uri)
}
}

#[cfg(test)]
mod test {
use super::*;

#[test]
fn simple_builder() {
let mut cpe = Uri::builder();
cpe.part("a")
.vendor("acme")
.product("tools")
.version("1.0.0")
.update("u1")
.edition("e1")
.language("en");

assert_eq!(
cpe.validate().unwrap().to_string(),
"cpe:/a:acme:tools:1.0.0:u1:e1:en"
);
}
}

0 comments on commit 0b99032

Please sign in to comment.