Skip to content

Commit

Permalink
update tests and readme
Browse files Browse the repository at this point in the history
  • Loading branch information
cksac committed Oct 25, 2023
1 parent 1ec3269 commit 851d530
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 10 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 9 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Default:

```toml
[dependencies]
fake = { version = "2.10", features = ["derive"] }
fake = { version = "2.9", features = ["derive"] }
```

Available features:
Expand Down Expand Up @@ -50,10 +50,18 @@ pub struct Foo {
paid: bool,
}

#[derive(Debug, Dummy)]
struct Bar<T> {
field: Vec<T>,
}

fn main() {
// type derived Dummy
let f: Foo = Faker.fake();
println!("{:?}", f);

let b: Bar<Foo> = Faker.fake();
println!("{:?}", b);

// using `Faker` to generate default fake value of given type
let tuple = Faker.fake::<(u8, u32, f32)>();
Expand Down
2 changes: 1 addition & 1 deletion fake/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "fake"
version = "2.10.0"
version = "2.9.0"
authors = ["cksac <[email protected]>"]
description = "An easy to use library for generating fake data like name, number, address, lorem, dates, etc."
keywords = ["faker", "data", "generator", "random"]
Expand Down
10 changes: 9 additions & 1 deletion fake/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Default:

```toml
[dependencies]
fake = { version = "2.10", features = ["derive"] }
fake = { version = "2.9", features = ["derive"] }
```

Available features:
Expand Down Expand Up @@ -49,11 +49,19 @@ pub struct Foo {
paid: bool,
}

#[derive(Debug, Dummy)]
struct Bar<T> {
field: Vec<T>,
}

fn main() {
// type derived Dummy
let f: Foo = Faker.fake();
println!("{:?}", f);

let b: Bar<Foo> = Faker.fake();
println!("{:?}", b);

// using `Faker` to generate default fake value of given type
let tuple = Faker.fake::<(u8, u32, f32)>();
println!("tuple {:?}", tuple);
Expand Down
12 changes: 6 additions & 6 deletions fake/tests/derive_macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand All @@ -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]
Expand Down

0 comments on commit 851d530

Please sign in to comment.