From 851d530d698000bb03ad85346827f11074acb12e Mon Sep 17 00:00:00 2001 From: cksac Date: Wed, 25 Oct 2023 23:35:03 +0800 Subject: [PATCH] update tests and readme --- Cargo.lock | 2 +- README.md | 10 +++++++++- fake/Cargo.toml | 2 +- fake/README.md | 10 +++++++++- fake/tests/derive_macros.rs | 12 ++++++------ 5 files changed, 26 insertions(+), 10 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index f246cd6..203f806 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -266,7 +266,7 @@ dependencies = [ [[package]] name = "fake" -version = "2.10.0" +version = "2.9.0" dependencies = [ "bigdecimal", "chrono", diff --git a/README.md b/README.md index 62ea1f4..5372507 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ Default: ```toml [dependencies] -fake = { version = "2.10", features = ["derive"] } +fake = { version = "2.9", features = ["derive"] } ``` Available features: @@ -50,10 +50,18 @@ pub struct Foo { paid: bool, } +#[derive(Debug, Dummy)] +struct Bar { + field: Vec, +} + fn main() { // type derived Dummy let f: Foo = Faker.fake(); println!("{:?}", f); + + let b: Bar = Faker.fake(); + println!("{:?}", b); // using `Faker` to generate default fake value of given type let tuple = Faker.fake::<(u8, u32, f32)>(); diff --git a/fake/Cargo.toml b/fake/Cargo.toml index 4f725cc..f4d9c29 100644 --- a/fake/Cargo.toml +++ b/fake/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "fake" -version = "2.10.0" +version = "2.9.0" authors = ["cksac "] description = "An easy to use library for generating fake data like name, number, address, lorem, dates, etc." keywords = ["faker", "data", "generator", "random"] diff --git a/fake/README.md b/fake/README.md index 42a12d3..81600cb 100644 --- a/fake/README.md +++ b/fake/README.md @@ -11,7 +11,7 @@ Default: ```toml [dependencies] -fake = { version = "2.10", features = ["derive"] } +fake = { version = "2.9", features = ["derive"] } ``` Available features: @@ -49,11 +49,19 @@ pub struct Foo { paid: bool, } +#[derive(Debug, Dummy)] +struct Bar { + field: Vec, +} + fn main() { // type derived Dummy let f: Foo = Faker.fake(); println!("{:?}", f); + let b: Bar = Faker.fake(); + println!("{:?}", b); + // using `Faker` to generate default fake value of given type let tuple = Faker.fake::<(u8, u32, f32)>(); println!("tuple {:?}", tuple); diff --git a/fake/tests/derive_macros.rs b/fake/tests/derive_macros.rs index 73fce99..672ea72 100644 --- a/fake/tests/derive_macros.rs +++ b/fake/tests/derive_macros.rs @@ -170,9 +170,9 @@ mod field_options { pub name: String, } - let o: Obj = Faker.fake_with_rng(&mut rng()); - - assert_eq!(o.name, "5KuGzxfjPN9Ha"); + let o1: Obj = Faker.fake_with_rng(&mut rng()); + let o2: Obj = Faker.fake_with_rng(&mut rng()); + assert_eq!(o1.name, o2.name); } #[test] @@ -196,9 +196,9 @@ mod field_options { pub name: String, } - let o: Obj = Faker.fake_with_rng(&mut rng()); - - assert_eq!(o.name, "Marietta Maggio"); + let o1: Obj = Faker.fake_with_rng(&mut rng()); + let o2: Obj = Faker.fake_with_rng(&mut rng()); + assert_eq!(o1.name, o2.name); } #[test]