Skip to content

Commit 0d9991c

Browse files
authored
Merge pull request dtolnay#146 from dtolnay/doctest
Enable testing of documentation examples
2 parents 102ee29 + 6dfc6a6 commit 0d9991c

File tree

2 files changed

+16
-4
lines changed

2 files changed

+16
-4
lines changed

.travis.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,11 @@ sudo: false
33

44
matrix:
55
include:
6-
- rust: 1.15.0
6+
- rust: 1.15.0 # oldest supported version
7+
script: cargo build
8+
- rust: 1.19.0 # first release with the --tests flag
9+
script: cargo test --tests
10+
- rust: 1.26.0 # first release on which our doc tests pass
711
- rust: stable
812
- rust: beta
913
- rust: nightly

Cargo.toml

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,16 @@ option, off by default, to also reimplement itself in terms of the upstream
1515
unstable API.
1616
"""
1717

18-
[lib]
19-
doctest = false
20-
2118
[package.metadata.docs.rs]
2219
rustc-args = ["--cfg", "procmacro2_semver_exempt"]
2320
rustdoc-args = ["--cfg", "procmacro2_semver_exempt"]
2421

2522
[dependencies]
2623
unicode-xid = "0.1"
2724

25+
[dev-dependencies]
26+
quote = "0.6"
27+
2828
[features]
2929
# When enabled: act as a shim around the nightly compiler's proc_macro crate.
3030
# This requires a nightly compiler.
@@ -38,3 +38,11 @@ default = ["proc-macro"]
3838

3939
[badges]
4040
travis-ci = { repository = "alexcrichton/proc-macro2" }
41+
42+
[patch.crates-io]
43+
# Our doc tests depend on quote which depends on proc-macro2. Without this line,
44+
# the proc-macro2 dependency of quote would be the released version of
45+
# proc-macro2. Quote would implement its traits for types from that proc-macro2,
46+
# meaning impls would be missing when tested against types from the local
47+
# proc-macro2.
48+
proc-macro2 = { path = "." }

0 commit comments

Comments
 (0)