Skip to content

Commit

Permalink
Update tests/bench/examples with new builder syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
hamiltop committed Jul 20, 2023
1 parent c58b032 commit d7a94b3
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 32 deletions.
42 changes: 21 additions & 21 deletions benches/benchmark.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ struct TestCases {

fn bench_os(c: &mut Criterion) {
let parser = UserAgentParser::builder()
.device(false)
.os(true)
.user_agent(false)
.with_device(false)
.with_os(true)
.with_user_agent(false)
.build_from_yaml("./src/core/regexes.yaml")
.expect("Parser creation failed");

Expand All @@ -34,10 +34,10 @@ fn bench_os(c: &mut Criterion) {
});

let parser = UserAgentParser::builder()
.device(false)
.os(true)
.user_agent(false)
.unicode(false)
.with_device(false)
.with_os(true)
.with_user_agent(false)
.with_unicode_support(false)
.build_from_yaml("./src/core/regexes.yaml")
.expect("Parser creation failed");

Expand All @@ -52,9 +52,9 @@ fn bench_os(c: &mut Criterion) {

fn bench_device(c: &mut Criterion) {
let parser = UserAgentParser::builder()
.device(true)
.os(false)
.user_agent(false)
.with_device(true)
.with_os(false)
.with_user_agent(false)
.build_from_yaml("./src/core/regexes.yaml")
.expect("Parser creation failed");

Expand All @@ -70,10 +70,10 @@ fn bench_device(c: &mut Criterion) {
});

let parser = UserAgentParser::builder()
.device(true)
.os(false)
.user_agent(false)
.unicode(false)
.with_device(true)
.with_os(false)
.with_user_agent(false)
.with_unicode_support(false)
.build_from_yaml("./src/core/regexes.yaml")
.expect("Parser creation failed");

Expand All @@ -88,9 +88,9 @@ fn bench_device(c: &mut Criterion) {

fn bench_ua(c: &mut Criterion) {
let parser = UserAgentParser::builder()
.device(false)
.os(false)
.user_agent(true)
.with_device(false)
.with_os(false)
.with_user_agent(true)
.build_from_yaml("./src/core/regexes.yaml")
.expect("Parser creation failed");

Expand All @@ -106,10 +106,10 @@ fn bench_ua(c: &mut Criterion) {
});

let parser = UserAgentParser::builder()
.device(false)
.os(false)
.user_agent(true)
.unicode(false)
.with_device(false)
.with_os(false)
.with_user_agent(true)
.with_unicode_support(false)
.build_from_yaml("./src/core/regexes.yaml")
.expect("Parser creation failed");

Expand Down
2 changes: 1 addition & 1 deletion examples/no_unicode_parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use uaparser::{Parser, UserAgentParser};

fn main() {
let parser = UserAgentParser::builder()
.unicode(false)
.with_unicode_support(false)
.build_from_yaml("./src/core/regexes.yaml")
.expect("Parser creation failed");

Expand Down
8 changes: 4 additions & 4 deletions examples/os_only_no_unicode_parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ use uaparser::{Parser, UserAgentParser};

fn main() {
let parser = UserAgentParser::builder()
.unicode(false)
.device(false)
.os(true)
.user_agent(false)
.with_unicode_support(false)
.with_device(false)
.with_os(true)
.with_user_agent(false)
.build_from_yaml("./src/core/regexes.yaml")
.expect("Parser creation failed");

Expand Down
12 changes: 6 additions & 6 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ mod tests {
#[test]
fn parse_os_with_unicode() {
let parser = UserAgentParser::builder()
.unicode(true)
.with_unicode_support(true)
.build_from_yaml("./src/core/regexes.yaml")
.expect("Parser creation failed");
do_parse_os_test_with_parser(&parser)
Expand All @@ -90,7 +90,7 @@ mod tests {
#[test]
fn parse_os_without_unicode() {
let parser = UserAgentParser::builder()
.unicode(false)
.with_unicode_support(false)
.build_from_yaml("./src/core/regexes.yaml")
.expect("Parser creation failed");
do_parse_os_test_with_parser(&parser)
Expand Down Expand Up @@ -168,7 +168,7 @@ mod tests {
#[test]
fn parse_device_with_unicode() {
let parser = UserAgentParser::builder()
.unicode(true)
.with_unicode_support(true)
.build_from_yaml("./src/core/regexes.yaml")
.expect("Parser creation failed");
do_parse_device_test_with_parser(&parser)
Expand All @@ -177,7 +177,7 @@ mod tests {
#[test]
fn parse_device_without_unicode() {
let parser = UserAgentParser::builder()
.unicode(false)
.with_unicode_support(false)
.build_from_yaml("./src/core/regexes.yaml")
.expect("Parser creation failed");
do_parse_device_test_with_parser(&parser)
Expand Down Expand Up @@ -240,7 +240,7 @@ mod tests {
#[test]
fn parse_user_agent_with_unicode() {
let parser = UserAgentParser::builder()
.unicode(true)
.with_unicode_support(true)
.build_from_yaml("./src/core/regexes.yaml")
.expect("Parser creation failed");
do_parse_user_agent_test_with_parser(&parser)
Expand All @@ -249,7 +249,7 @@ mod tests {
#[test]
fn parse_user_agent_without_unicode() {
let parser = UserAgentParser::builder()
.unicode(false)
.with_unicode_support(false)
.build_from_yaml("./src/core/regexes.yaml")
.expect("Parser creation failed");
do_parse_user_agent_test_with_parser(&parser)
Expand Down

0 comments on commit d7a94b3

Please sign in to comment.