Skip to content

Commit

Permalink
Merge pull request #764 from hyperium/readme-tests
Browse files Browse the repository at this point in the history
test(readme): test readme code fences
  • Loading branch information
seanmonstar committed Apr 20, 2016
2 parents 635622c + b98662a commit 4bdf52a
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ cache:
- target/debug/build

script:
- ./.travis/readme.py
- cargo build --verbose $FEATURES
- cargo test --verbose $FEATURES
- 'if [ $TRAVIS_RUST_VERSION = nightly ]; then cargo bench --no-run; fi'
Expand Down
10 changes: 10 additions & 0 deletions .travis/readme.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/usr/bin/env python

import re

f = open('README.md', 'r')
raw = f.read()

for (i, code) in enumerate(re.findall(r'```rust([^`]*)```', raw, re.M)):
with open('examples/readme_%s.rs' % i, 'w') as f:
f.write('#![deny(warnings)]%s' % code)
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ use hyper::header::Connection;

fn main() {
// Create a client.
let mut client = Client::new();
let client = Client::new();

// Creating an outgoing request.
let mut res = client.get("http://rust-lang.org/")
Expand Down

0 comments on commit 4bdf52a

Please sign in to comment.