Skip to content

Fix several shell output and code highlights. #1222

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 23, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/attribute/cfg/custom.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Try to run this to see what happens without the custom `cfg` flag.

With the custom `cfg` flag:

```bash
```shell
$ rustc --cfg some_condition custom.rs && ./custom
condition met!
```
2 changes: 1 addition & 1 deletion src/attribute/crate.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ pub fn indirect_access() {
When the `crate_type` attribute is used, we no longer need to pass the
`--crate-type` flag to `rustc`.

```bash
```shell
$ rustc lib.rs
$ ls lib*
library.rlib
Expand Down
12 changes: 6 additions & 6 deletions src/cargo/test.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@ Each file in `tests` is a separate integration test.

`cargo` naturally provides an easy way to run all of your tests!

```sh
cargo test
```shell
$ cargo test
```

You should see output like this:

```txt
```shell
$ cargo test
Compiling blah v0.1.0 (file:///nobackup/blah)
Finished dev [unoptimized + debuginfo] target(s) in 0.89 secs
Expand All @@ -46,11 +46,11 @@ test result: ok. 3 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out

You can also run tests whose name matches a pattern:

```sh
cargo test test_foo
```shell
$ cargo test test_foo
```

```txt
```shell
$ cargo test test_foo
Compiling blah v0.1.0 (file:///nobackup/blah)
Finished dev [unoptimized + debuginfo] target(s) in 0.35 secs
Expand Down
2 changes: 1 addition & 1 deletion src/crates/lib.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ pub fn indirect_access() {
}
```

```bash
```shell
$ rustc --crate-type=lib rary.rs
$ ls lib*
library.rlib
Expand Down
2 changes: 1 addition & 1 deletion src/crates/link.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ fn main() {
}
```

```bash
```txt
# Where library.rlib is the path to the compiled library, assumed that it's
# in the same directory here:
$ rustc executable.rs --extern rary=library.rlib && ./executable
Expand Down
2 changes: 1 addition & 1 deletion src/macros/dry.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ mod test {
}
```

```bash
```shell
$ rustc --test dry.rs && ./dry
running 3 tests
test test::mul_assign ... ok
Expand Down
2 changes: 1 addition & 1 deletion src/meta/doc.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ fn main() {
To run the tests, first build the code as a library, then tell rustdoc where
to find the library so it can link it into each doctest program:

```bash
```shell
$ rustc doc.rs --crate-type lib
$ rustdoc --test --extern doc="libdoc.rlib" doc.rs
```
Expand Down
4 changes: 2 additions & 2 deletions src/mod/split.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Modules can be mapped to a file/directory hierarchy. Let's break down the
[visibility example][visibility] in files:

```bash
```shell
$ tree .
.
|-- my
Expand Down Expand Up @@ -84,7 +84,7 @@ pub fn public_function() {

Let's check that things still work as before:

```bash
```shell
$ rustc split.rs && ./split
called `my::function()`
called `function()`
Expand Down
2 changes: 1 addition & 1 deletion src/scope/raii.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ fn main() {

Of course, we can double check for memory errors using [`valgrind`][valgrind]:

```bash
```shell
$ rustc raii.rs && valgrind ./raii
==26873== Memcheck, a memory error detector
==26873== Copyright (C) 2002-2013, and GNU GPL'd, by Julian Seward et al.
Expand Down
2 changes: 1 addition & 1 deletion src/std/panic.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ fn main() {

Let's check that `panic!` doesn't leak memory.

```bash
```shell
$ rustc panic.rs && valgrind ./panic
==4401== Memcheck, a memory error detector
==4401== Copyright (C) 2002-2013, and GNU GPL'd, by Julian Seward et al.
Expand Down
2 changes: 1 addition & 1 deletion src/std_misc/arg.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ fn main() {
}
```

```bash
```shell
$ ./args 1 2 3
My path is ./args.
I got 3 arguments: ["1", "2", "3"].
Expand Down
2 changes: 1 addition & 1 deletion src/std_misc/arg/matching.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ fn main() {
}
```

```bash
```shell
$ ./match_args Rust
This is not the answer.
$ ./match_args 42
Expand Down
2 changes: 1 addition & 1 deletion src/std_misc/file/create.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ fn main() {

Here's the expected successful output:

```bash
```shell
$ mkdir out
$ rustc create.rs && ./create
successfully wrote to out/lorem_ipsum.txt
Expand Down
2 changes: 1 addition & 1 deletion src/std_misc/file/open.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ fn main() {

Here's the expected successful output:

```bash
```shell
$ echo "Hello World!" > hello.txt
$ rustc open.rs && ./open
hello.txt contains:
Expand Down
2 changes: 1 addition & 1 deletion src/std_misc/file/read_lines.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ where P: AsRef<Path>, {
```

Running this program simply prints the lines individually.
```bash
```shell
$ echo -e "127.0.0.1\n192.168.0.1\n" > hosts
$ rustc read_lines.rs && ./read_lines
127.0.0.1
Expand Down
4 changes: 2 additions & 2 deletions src/std_misc/fs.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ fn main() {

Here's the expected successful output:

```bash
```shell
$ rustc fs.rs && ./fs
`mkdir a`
`echo hello > a/b.txt`
Expand All @@ -118,7 +118,7 @@ $ rustc fs.rs && ./fs

And the final state of the `a` directory is:

```text
```shell
$ tree a
a
|-- b.txt
Expand Down
2 changes: 1 addition & 1 deletion src/testing/dev_dependencies.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ packages which depend on this package.
One such example is using a crate that extends standard `assert!` macros.
File `Cargo.toml`:

```ignore
```toml
# standard crate data is left out
[dev-dependencies]
pretty_assertions = "0.4.0"
Expand Down
2 changes: 1 addition & 1 deletion src/testing/doc_testing.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ pub fn div(a: i32, b: i32) -> i32 {

Tests can be run with `cargo test`:

```bash
```shell
$ cargo test
running 0 tests

Expand Down
2 changes: 1 addition & 1 deletion src/testing/integration_testing.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ fn test_add() {

Running tests with `cargo test` command:

```bash
```shell
$ cargo test
running 0 tests

Expand Down
10 changes: 5 additions & 5 deletions src/testing/unit_testing.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ mod tests {

Tests can be run with `cargo test`.

```bash
```shell
$ cargo test

running 2 tests
Expand Down Expand Up @@ -112,7 +112,7 @@ mod tests {

Running these tests gives us:

```bash
```shell
$ cargo test

running 3 tests
Expand All @@ -133,7 +133,7 @@ test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out

To run specific tests one may specify the test name to `cargo test` command.

```bash
```shell
$ cargo test test_any_panic
running 1 test
test tests::test_any_panic ... ok
Expand All @@ -150,7 +150,7 @@ test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out
To run multiple tests one may specify part of a test name that matches all the
tests that should be run.

```bash
```shell
$ cargo test panic
running 2 tests
test tests::test_any_panic ... ok
Expand Down Expand Up @@ -198,7 +198,7 @@ mod tests {
}
```

```bash
```shell
$ cargo test
running 1 test
test tests::ignored_test ... ignored
Expand Down