about summary refs log tree commit diff
path: root/src/test/rustdoc
diff options
context:
space:
mode:
authorkennytm <kennytm@gmail.com>2017-12-20 21:21:56 +0800
committerGitHub <noreply@github.com>2017-12-20 21:21:56 +0800
commitcc3f4357d37e87449313c8af355f4331a5289b8d (patch)
tree852ab82950fc77381f04c1bfb3a365e760e7b20a /src/test/rustdoc
parent1d57459fc99aee3f3af4c282965ccd9689f3aa59 (diff)
parentb3c6102be3752fa1b70cc5f9cf9903b13a4c3928 (diff)
downloadrust-cc3f4357d37e87449313c8af355f4331a5289b8d.tar.gz
rust-cc3f4357d37e87449313c8af355f4331a5289b8d.zip
Rollup merge of #46787 - varkor:contrib-6, r=QuietMisdreavus
Add an option to allow rustdoc to list modules by appearance

The `--sort-modules-by-appearance` option will list modules in the
order that they appear in the source, rather than sorting them
alphabetically (as is the default). This resolves #8552.
Diffstat (limited to 'src/test/rustdoc')
-rw-r--r--src/test/rustdoc/sort-modules-by-appearance.rs23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/test/rustdoc/sort-modules-by-appearance.rs b/src/test/rustdoc/sort-modules-by-appearance.rs
new file mode 100644
index 00000000000..abffe6fb95b
--- /dev/null
+++ b/src/test/rustdoc/sort-modules-by-appearance.rs
@@ -0,0 +1,23 @@
+// 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.
+
+// Tests the rustdoc --sort-modules-by-appearance option, that allows module declarations to appear
+// in the order they are declared in the source code, rather than only alphabetically.
+
+// compile-flags: -Z unstable-options --sort-modules-by-appearance
+
+pub mod module_b {}
+
+pub mod module_c {}
+
+pub mod module_a {}
+
+// @matches 'sort_modules_by_appearance/index.html' '(?s)module_b.*module_c.*module_a'
+// @matches 'sort_modules_by_appearance/sidebar-items.js' '"module_b".*"module_c".*"module_a"'