~~~
Rustdoc also supplies some extra sugar for helping with some tedious
-documentation examples. If a line os prefixed with a `#` character, then the
+documentation examples. If a line is prefixed with a `#` character, then the
line will not show up in the HTML documentation, but it will be used when
testing the code block.
There are a number of related macros in the `format!` family. The ones that are
currently implemented are:
-```rust,notest
+```rust,ignore
format! // described above
write! // first argument is a &mut io::Writer, the destination
writeln! // same as write but appends a newline
use std::io::buffered::BufferedReader;
use std::io::stdin;
+ # let _g = ::std::io::ignore_io_error();
let mut stdin = BufferedReader::new(stdin());
for line in stdin.lines() {
print(line);
```rust
use std::io::File;
+ # let _g = ::std::io::ignore_io_error();
let contents = File::open(&Path::new("message.txt")).read_to_end();
```
```rust
use std::io::File;
+ # let _g = ::std::io::ignore_io_error();
let mut file = File::create(&Path::new("message.txt"));
file.write(bytes!("hello, file!\n"));
```
use std::io::buffered::BufferedReader;
use std::io::File;
+ # let _g = ::std::io::ignore_io_error();
let path = Path::new("message.txt");
let mut file = BufferedReader::new(File::open(&path));
for line in file.lines() {
use std::io::buffered::BufferedReader;
use std::io::File;
+ # let _g = ::std::io::ignore_io_error();
let path = Path::new("message.txt");
let mut file = BufferedReader::new(File::open(&path));
let lines: ~[~str] = file.lines().collect();
XXX This needs more improvement: TcpStream constructor taking &str,
`write_str` and `write_line` methods.
- ```rust,ignore
+ ```rust,should_fail
use std::io::net::ip::SocketAddr;
use std::io::net::tcp::TcpStream;
+ # let _g = ::std::io::ignore_io_error();
let addr = from_str::<SocketAddr>("127.0.0.1:8080").unwrap();
let mut socket = TcpStream::connect(addr).unwrap();
socket.write(bytes!("GET / HTTP/1.0\n\n"));