about summary refs log tree commit diff
path: root/src/test/rustdoc
diff options
context:
space:
mode:
authorGuillaume Gomez <guillaume1.gomez@gmail.com>2017-08-13 11:03:09 +0200
committerGitHub <noreply@github.com>2017-08-13 11:03:09 +0200
commit7ebd81377db0e24f57be9c4f7aa84d2556931f1a (patch)
tree20f8c61828289792c264a66dbfc9fdaf7c0cf2ba /src/test/rustdoc
parentadbce60d6f131e5b3789f01417dedb05e4489898 (diff)
parent6d736df76bb37e019728cea50a4902c23fb09e1b (diff)
downloadrust-7ebd81377db0e24f57be9c4f7aa84d2556931f1a.tar.gz
rust-7ebd81377db0e24f57be9c4f7aa84d2556931f1a.zip
Rollup merge of #43782 - nrc:include, r=GuillaumeGomez
Fix include! in doc tests

By making the path relative to the current file.

Fixes #43153

[breaking-change] - if you use `include!` inside a doc test, you'll need to change the path to be relative to the current file rather than relative to the working directory.
Diffstat (limited to 'src/test/rustdoc')
-rw-r--r--src/test/rustdoc/issue-43153.rs20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/test/rustdoc/issue-43153.rs b/src/test/rustdoc/issue-43153.rs
new file mode 100644
index 00000000000..6ac341d8b02
--- /dev/null
+++ b/src/test/rustdoc/issue-43153.rs
@@ -0,0 +1,20 @@
+// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// Test that `include!` in a doc test searches relative to the directory in
+// which the test is declared.
+
+// compile-flags:--test
+
+/// ```rust
+/// include!("auxiliary/empty.rs");
+/// fn main() {}
+/// ```
+pub struct Foo;