Skip to content

Commit 2d79dc2

Browse files
(MAINT) Disable docs tests for library crates by default
Prior to this change, invoking `cargo test` for library crates without specifically choosing a test subset (unit, integration, etc) would always run the documentation tests. Documentation tests are particularly slow because Rust compiles a binary for every codeblock in your documentation. This is the slowest part of the rust tests when working on a library with extensive examples. This change adds the `doctest` setting to the crate manifests as `false` to disable documentation tests by default. These tests can still be invoked by passing the `--doc` flag to `cargo test`. Future changes will provide simplified access to generating and testing the docs from the build script, as well as validating documentation in CI.
1 parent ce56e6f commit 2d79dc2

File tree

8 files changed

+49
-0
lines changed

8 files changed

+49
-0
lines changed

grammars/tree-sitter-dscexpression/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ include = [
1818

1919
[lib]
2020
path = "bindings/rust/lib.rs"
21+
doctest = false
2122

2223
[dependencies]
2324
tree-sitter-rust = { workspace = true }

grammars/tree-sitter-ssh-server-config/Cargo.toml

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
// Copyright (c) Microsoft Corporation.
2+
// Licensed under the MIT License.
3+
4+
//! Provides helper functions for working with VS Code's extended JSON Schema keywords with
5+
//! [`schemars::Schema`] instances.
6+
//!
7+
//! The `get_keyword_as_*` functions simplify retrieving the value of a keyword for a given type.
8+
//! If the schema defines the keyword with the expected type, those functions return a reference to
9+
//! that value as the correct type. If the keyword doesn't exist or has the wrong value type, the
10+
//! functions return [`None`].
11+
//!
12+
//! The rest of the utility methods work with specific keywords, like `$id` and `$defs`.
13+
14+
use core::{clone::Clone, iter::Iterator, option::Option::None};
15+
use std::string::String;
16+
17+
use schemars::Schema;
18+
use serde_json::{Map, Number, Value};
19+
use url::{Position, Url};
20+
21+
type Array = Vec<Value>;
22+
type Object = Map<String, Value>;
23+
24+
pub trait VSCodeSchemaExtensions {
25+
fn has_markdown_description(&self) -> bool;
26+
}
27+
28+
impl VSCodeSchemaExtensions for Schema {
29+
fn has_markdown_description(&self) -> bool {
30+
self.get("markdownDescription").is_some()
31+
}
32+
}

lib/dsc-lib-osinfo/Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ name = "dsc-lib-osinfo"
33
version = "1.0.0"
44
edition = "2021"
55

6+
[lib]
7+
doctest = false
8+
69
[dependencies]
710
os_info = { workspace = true }
811
serde = { workspace = true }

lib/dsc-lib-pal/Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,8 @@ name = "dsc-lib-pal"
55
version = "0.1.0"
66
edition = "2021"
77

8+
[lib]
9+
doctest = false
10+
811
[build-dependencies]
912
cc = { workspace = true }

lib/dsc-lib-registry/Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ available-locales = ["en-us"]
88
default-locale = "en-us"
99
load-path = "locales"
1010

11+
[lib]
12+
doctest = false
13+
1114
[dependencies]
1215
crossterm = { workspace = true }
1316
registry = { workspace = true }

lib/dsc-lib-security_context/Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ name = "dsc-lib-security_context"
33
version = "0.1.0"
44
edition = "2021"
55

6+
[lib]
7+
doctest = false
8+
69
[target.'cfg(target_os = "windows")'.dependencies]
710
is_elevated = { workspace = true }
811

lib/dsc-lib/Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ name = "dsc-lib"
33
version = "3.2.0"
44
edition = "2021"
55

6+
[lib]
7+
doctest = false
8+
69
[dependencies]
710
# external dependencies
811
base32 = { workspace = true }

0 commit comments

Comments
 (0)