rust/src/tools
Aleksey Kladov f7be59c593 Introduce expect snapshot testing library into rustc
Snapshot testing is a technique for writing maintainable unit tests.
Unlike usual `assert_eq!` tests, snapshot tests allow
to *automatically* upgrade expected values on test failure.
In a sense, snapshot tests are inline-version of our beloved
UI-tests.

Example:

![expect](https://user-images.githubusercontent.com/1711539/90888810-3bcc8180-e3b7-11ea-9626-d06e89e1a0bb.gif)

A particular library we use, `expect_test` provides an `expect!`
macro, which creates a sort of self-updating string literal (by using
`file!` macro). Self-update is triggered by setting `UPDATE_EXPECT`
environmental variable (this info is printed during the test failure).
This library was extracted from rust-analyzer, where we use it for
most of our tests.

There are some other, more popular snapshot testing libraries:

* https://github.com/mitsuhiko/insta
* https://github.com/aaronabramov/k9

The main differences of `expect` are:

* first-class snapshot objects (so, tests can be written as functions,
  rather than as macros)
* focus on inline-snapshots (but file snapshots are also supported)
* restricted feature set (only `assert_eq` and `assert_debug_eq`)
* no extra runtime (ie, no `cargo insta`)

See https://github.com/rust-analyzer/rust-analyzer/pull/5101 for a
an extended comparison.

It is unclear if this testing style will stick with rustc in the long
run. At the moment, rustc is mainly tested via integrated UI tests.
But in the library-ified world, unit-tests will become somewhat more
important (that's why use use `rustc_lexer` library-ified library as
an example in this PR). Given that the cost of removal shouldn't be
too high, it probably makes sense to just see if this flies!
2020-08-24 15:38:42 +02:00
..
build-manifest Add rustc-docs as a component 2020-08-15 07:11:29 -04:00
cargo@51b66125ba Update cargo 2020-08-19 15:11:58 -07:00
cargotest cargotest: fix clippy warnings 2020-08-22 01:50:47 +02:00
clippy Capture tokens for Pat used in macro_rules! argument 2020-08-20 02:45:28 -04:00
compiletest compiletest: fix a couple clippy lint findings 2020-08-22 11:44:30 +02:00
error_index_generator Eliminate the SessionGlobals from librustc_ast. 2020-08-08 12:03:42 +10:00
expand-yaml-anchors expand-yaml-anchors: fix clippy::match_ref_pats and clippy::redundant_closure 2020-08-23 23:53:53 +02:00
linkchecker linkcheckr: fix clippy::redundant_static_lifetimes and clippy::single_char_pattern 2020-08-23 23:53:53 +02:00
miri@2d6d73fafe update miri 2020-08-18 11:04:01 +02:00
remote-test-client Support configurable deny-warnings for all in-tree crates. 2020-06-25 21:17:21 -07:00
remote-test-server Support configurable deny-warnings for all in-tree crates. 2020-06-25 21:17:21 -07:00
rls@48ef96dd00 Bump RLS 2020-08-18 13:02:03 +02:00
rust-analyzer@0b2b9a5508 ⬆️ rust-analyzer 2020-08-17 16:15:20 +02:00
rust-demangler Generating the coverage map 2020-07-17 11:49:35 -07:00
rust-installer@d66f476b4d Update rust-installer to latest version 2020-07-07 14:15:51 -07:00
rustbook Update mdbook. 2020-06-26 07:47:19 -07:00
rustc-workspace-hack Stop using old version of syn in rustc-workspace-hack 2020-06-22 13:29:39 -04:00
rustdoc Format the world 2019-12-22 17:42:47 -05:00
rustdoc-js rustdoc: Fix doc aliases with crate filtering 2020-06-23 09:27:37 +01:00
rustdoc-themes Format the world 2019-12-22 17:42:47 -05:00
rustfmt@48f6c32ec1 Update RLS and Rustfmt 2020-08-12 01:25:46 +02:00
tidy Introduce expect snapshot testing library into rustc 2020-08-24 15:38:42 +02:00
tier-check Add a script to verify the Platform Support page is up-to-date. 2020-08-12 08:40:22 -07:00
unicode-table-generator unicode_table_generator: fix clippy::writeln_empty_string, clippy::useless_format, clippy:::for_kv_map 2020-08-24 00:43:50 +02:00
unstable-book-gen unstable-book-gen: fix clippy::single_char_pattern and clippy::iter_skip_next 2020-08-24 00:47:38 +02:00
publish_toolstate.py publish-toolstate: show more context on HTTP error 2020-08-23 11:29:27 -07:00