mirror of
https://github.com/rust-lang/rustlings.git
synced 2026-01-06 10:49:19 +00:00
Update order creation in structs2.rs
This commit is contained in:
parent
853394ec14
commit
aea00abd1c
@ -5,8 +5,6 @@
|
|||||||
// Execute `rustlings hint structs2` or use the `hint` watch subcommand for a
|
// Execute `rustlings hint structs2` or use the `hint` watch subcommand for a
|
||||||
// hint.
|
// hint.
|
||||||
|
|
||||||
// I AM NOT DONE
|
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
struct Order {
|
struct Order {
|
||||||
name: String,
|
name: String,
|
||||||
@ -38,7 +36,12 @@ mod tests {
|
|||||||
fn your_order() {
|
fn your_order() {
|
||||||
let order_template = create_order_template();
|
let order_template = create_order_template();
|
||||||
// TODO: Create your own order using the update syntax and template above!
|
// TODO: Create your own order using the update syntax and template above!
|
||||||
// let your_order =
|
let your_order = Order {
|
||||||
|
name: String::from("Hacker in Rust"),
|
||||||
|
count: 1,
|
||||||
|
..order_template
|
||||||
|
};
|
||||||
|
|
||||||
assert_eq!(your_order.name, "Hacker in Rust");
|
assert_eq!(your_order.name, "Hacker in Rust");
|
||||||
assert_eq!(your_order.year, order_template.year);
|
assert_eq!(your_order.year, order_template.year);
|
||||||
assert_eq!(your_order.made_by_phone, order_template.made_by_phone);
|
assert_eq!(your_order.made_by_phone, order_template.made_by_phone);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user