diff options
Diffstat (limited to 'src/doc/book/listings/ch17-oop/listing-17-11/src/main.rs')
-rw-r--r-- | src/doc/book/listings/ch17-oop/listing-17-11/src/main.rs | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/doc/book/listings/ch17-oop/listing-17-11/src/main.rs b/src/doc/book/listings/ch17-oop/listing-17-11/src/main.rs new file mode 100644 index 000000000..d99170a97 --- /dev/null +++ b/src/doc/book/listings/ch17-oop/listing-17-11/src/main.rs @@ -0,0 +1,20 @@ +// ANCHOR: all +use blog::Post; + +// ANCHOR: here +fn main() { + let mut post = Post::new(); + + post.add_text("I ate a salad for lunch today"); + assert_eq!("", post.content()); + // ANCHOR_END: here + + post.request_review(); + assert_eq!("", post.content()); + + post.approve(); + assert_eq!("I ate a salad for lunch today", post.content()); + // ANCHOR: here +} +// ANCHOR_END: here +// ANCHOR_END: all |