1
Fork 0

Fixing more doc tests

This commit is contained in:
Alex Crichton 2013-12-22 22:33:39 -08:00
parent 316345610a
commit f9b231cd08
6 changed files with 12 additions and 6 deletions

View file

@ -132,7 +132,7 @@ specifiers that can be used to dictate how a code block is tested:
~~~
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.

View file

@ -516,7 +516,7 @@ impl MatchOptions {
*
* This function always returns this value:
*
* ```rust,notest
* ```rust,ignore
* MatchOptions {
* case_sensitive: true,
* require_literal_separator: false.

View file

@ -25,7 +25,7 @@
//!
//! # Example
//!
//! ```rust,notest
//! ```rust,ignore
//! let (mut p1, c1) = Chan::new();
//! let (mut p2, c2) = Chan::new();
//!

View file

@ -222,7 +222,7 @@ fn main() {
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

View file

@ -29,6 +29,7 @@ Some examples of obvious things you might want to do
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);
@ -40,6 +41,7 @@ Some examples of obvious things you might want to do
```rust
use std::io::File;
# let _g = ::std::io::ignore_io_error();
let contents = File::open(&Path::new("message.txt")).read_to_end();
```
@ -48,6 +50,7 @@ Some examples of obvious things you might want to do
```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"));
```
@ -58,6 +61,7 @@ Some examples of obvious things you might want to do
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() {
@ -71,6 +75,7 @@ Some examples of obvious things you might want to do
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();
@ -80,10 +85,11 @@ Some examples of obvious things you might want to do
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"));

View file

@ -78,7 +78,7 @@ error,hello=warn // turn on global error logging and also warn for hello
Each of these macros will expand to code similar to:
```rust,notest
```rust,ignore
if log_level <= my_module_log_level() {
::std::logging::log(log_level, format!(...));
}