Skip to content

Commit

Permalink
fix: language is set to product field
Browse files Browse the repository at this point in the history
  • Loading branch information
ctron committed Jul 5, 2024
1 parent 4ae6bbe commit c3c05e6
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 c3c05e6

Please sign in to comment.