Update doctests

This commit is contained in:
Mingwei Samuel 2019-11-07 16:38:53 -08:00
parent 120e703f45
commit a604b5f39e
4 changed files with 7 additions and 5 deletions

View file

@ -2,7 +2,7 @@ language: rust
matrix: matrix:
fast_finish: true fast_finish: true
include: include:
- rust: beta - rust: stable
- rust: nightly - rust: nightly
env: FEATURES="--features nightly" env: FEATURES="--features nightly"
env: env:

View file

@ -16,6 +16,9 @@ travis-ci = { repository = "MingweiSamuel/Riven" }
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[package.metadata.docs.rs]
features = [ "nightly" ]
[features] [features]
nightly = [ "parking_lot/nightly" ] nightly = [ "parking_lot/nightly" ]

View file

@ -28,10 +28,9 @@ use riven::consts::Region;
// Riven Enter tokio async runtime. // Riven Enter tokio async runtime.
let rt = tokio::runtime::Runtime::new().unwrap(); let rt = tokio::runtime::Runtime::new().unwrap();
rt.block_on(async { rt.block_on(async {
// Create RiotApi instance from key. // Create RiotApi instance from key string.
let api_key = "RGAPI-01234567-89ab-cdef-0123-456789abcdef"; let api_key = "RGAPI-01234567-89ab-cdef-0123-456789abcdef";
let api_key = std::env::var("RGAPI_KEY").ok() # /* (doc testing) */ let api_key = std::env!("RGAPI_KEY");
.or_else(|| std::fs::read_to_string("apikey.txt").ok()).unwrap();
let riot_api = RiotApi::with_key(api_key); let riot_api = RiotApi::with_key(api_key);
// Get summoner data. // Get summoner data.

View file

@ -4,7 +4,7 @@
#![forbid(unsafe_code)] #![forbid(unsafe_code)]
#![cfg_attr(feature = "nightly", doc(include = "../README.md"))] #![cfg_attr(feature = "nightly", doc(include = "../README.md"))]
#![cfg_attr(not(feature = "nightly"), doc("See [README.md](https://github.com/MingweiSamuel/Riven#----riven--------------------)."))] #![cfg_attr(not(feature = "nightly"), doc = "See [README.md](https://github.com/MingweiSamuel/Riven#readme).")]
mod config; mod config;
pub use config::RiotApiConfig; pub use config::RiotApiConfig;