1
0
mirror of https://github.com/google/comprehensive-rust.git synced 2025-04-24 16:42:36 +02:00

zh-CN: translate testing (#970)

Part of #324.
This commit is contained in:
Martin Geisler 2023-07-19 09:29:42 +02:00 committed by GitHub
parent b8005ee37a
commit a11d3afe8c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -10623,11 +10623,11 @@ msgstr ""
#: src/testing.md:1 #: src/testing.md:1
msgid "# Testing" msgid "# Testing"
msgstr "" msgstr "# 测试"
#: src/testing.md:3 #: src/testing.md:3
msgid "Rust and Cargo come with a simple unit test framework:" msgid "Rust and Cargo come with a simple unit test framework:"
msgstr "" msgstr "Rust 和 Cargo 随附了一个简单的单元测试框架:"
#: src/testing.md:5 #: src/testing.md:5
msgid "" msgid ""
@ -10635,14 +10635,17 @@ msgid ""
"\n" "\n"
"* Integration tests are supported via the `tests/` directory." "* Integration tests are supported via the `tests/` directory."
msgstr "" msgstr ""
"* 单元测试在您的整个代码中都受支持。\n"
"\n"
"* 您可以通过 `tests/` 目录来支持集成测试。"
#: src/testing/unit-tests.md:1 #: src/testing/unit-tests.md:1
msgid "# Unit Tests" msgid "# Unit Tests"
msgstr "" msgstr "# 单元测试"
#: src/testing/unit-tests.md:3 #: src/testing/unit-tests.md:3
msgid "Mark unit tests with `#[test]`:" msgid "Mark unit tests with `#[test]`:"
msgstr "" msgstr "使用 `#[test]` 标记单元测试:"
#: src/testing/unit-tests.md:5 #: src/testing/unit-tests.md:5
msgid "" msgid ""
@ -10673,17 +10676,19 @@ msgstr ""
#: src/testing/unit-tests.md:29 #: src/testing/unit-tests.md:29
msgid "Use `cargo test` to find and run the unit tests." msgid "Use `cargo test` to find and run the unit tests."
msgstr "" msgstr "使用 `cargo test` 查找并运行单元测试。"
#: src/testing/test-modules.md:1 #: src/testing/test-modules.md:1
msgid "# Test Modules" msgid "# Test Modules"
msgstr "" msgstr "# 测试模块"
#: src/testing/test-modules.md:3 #: src/testing/test-modules.md:3
msgid "" msgid ""
"Unit tests are often put in a nested module (run tests on the\n" "Unit tests are often put in a nested module (run tests on the\n"
"[Playground](https://play.rust-lang.org/)):" "[Playground](https://play.rust-lang.org/)):"
msgstr "" msgstr ""
"单元测试通常会放在嵌套模块中(在 [Playground](https://play.rust-lang.org/) 上"
"运行测试):"
#: src/testing/test-modules.md:6 #: src/testing/test-modules.md:6
msgid "" msgid ""
@ -10713,14 +10718,16 @@ msgid ""
"* This lets you unit test private helpers.\n" "* This lets you unit test private helpers.\n"
"* The `#[cfg(test)]` attribute is only active when you run `cargo test`." "* The `#[cfg(test)]` attribute is only active when you run `cargo test`."
msgstr "" msgstr ""
"* 这样一来,您可以对专用帮助程序进行单元测试。\n"
"* 仅当您运行 `cargo test` 时,`#[cfg(test)]` 属性才有效。"
#: src/testing/doc-tests.md:1 #: src/testing/doc-tests.md:1
msgid "# Documentation Tests" msgid "# Documentation Tests"
msgstr "" msgstr "# 文档测试"
#: src/testing/doc-tests.md:3 #: src/testing/doc-tests.md:3
msgid "Rust has built-in support for documentation tests:" msgid "Rust has built-in support for documentation tests:"
msgstr "" msgstr "Rust 本身就支持文档测试:"
#: src/testing/doc-tests.md:5 #: src/testing/doc-tests.md:5
msgid "" msgid ""
@ -10745,18 +10752,23 @@ msgid ""
"* Test the above code on the [Rust Playground](https://play.rust-lang.org/?" "* Test the above code on the [Rust Playground](https://play.rust-lang.org/?"
"version=stable&mode=debug&edition=2021&gist=3ce2ad13ea1302f6572cb15cd96becf0)." "version=stable&mode=debug&edition=2021&gist=3ce2ad13ea1302f6572cb15cd96becf0)."
msgstr "" msgstr ""
"* `///` 注释中的代码块会自动被视为 Rust 代码。\n"
"* 代码会作为 `cargo test` 的一部分进行编译和执行。\n"
"* 在 [Rust Playground](https://play.rust-lang.org/?"
"version=stable&mode=debug&edition=2021&gist=3ce2ad13ea1302f6572cb15cd96becf0) "
"上测试上述代码。"
#: src/testing/integration-tests.md:1 #: src/testing/integration-tests.md:1
msgid "# Integration Tests" msgid "# Integration Tests"
msgstr "" msgstr "# 集成测试"
#: src/testing/integration-tests.md:3 #: src/testing/integration-tests.md:3
msgid "If you want to test your library as a client, use an integration test." msgid "If you want to test your library as a client, use an integration test."
msgstr "" msgstr "如果您想要以客户的身份测试您的库,请使用集成测试。"
#: src/testing/integration-tests.md:5 #: src/testing/integration-tests.md:5
msgid "Create a `.rs` file under `tests/`:" msgid "Create a `.rs` file under `tests/`:"
msgstr "" msgstr "在 `tests/` 下方创建一个 `.rs` 文件:"
#: src/testing/integration-tests.md:7 #: src/testing/integration-tests.md:7
msgid "" msgid ""
@ -10772,19 +10784,19 @@ msgstr ""
#: src/testing/integration-tests.md:16 #: src/testing/integration-tests.md:16
msgid "These tests only have access to the public API of your crate." msgid "These tests only have access to the public API of your crate."
msgstr "" msgstr "这些测试只能使用您的 crate 的公共 API。"
#: src/testing/useful-crates.md:1 #: src/testing/useful-crates.md:1
msgid "## Useful crates for writing tests" msgid "## Useful crates for writing tests"
msgstr "" msgstr "## 用于编写测试的实用 crate"
#: src/testing/useful-crates.md:3 #: src/testing/useful-crates.md:3
msgid "Rust comes with only basic support for writing tests." msgid "Rust comes with only basic support for writing tests."
msgstr "" msgstr "Rust 仅为编写测试提供基本支持。"
#: src/testing/useful-crates.md:5 #: src/testing/useful-crates.md:5
msgid "Here are some additional crates which we recommend for writing tests:" msgid "Here are some additional crates which we recommend for writing tests:"
msgstr "" msgstr "下面列出了我们建议在编写测试时使用的一些其他 crate:"
#: src/testing/useful-crates.md:7 #: src/testing/useful-crates.md:7
msgid "" msgid ""
@ -10794,6 +10806,10 @@ msgid ""
"* [rstest](https://docs.rs/rstest): Support for fixtures and parameterised " "* [rstest](https://docs.rs/rstest): Support for fixtures and parameterised "
"tests." "tests."
msgstr "" msgstr ""
"* [googletest](https://docs.rs/googletest):遵从 GoogleTest for C++ 传统的综"
"合测试断言库。\n"
"* [proptest](https://docs.rs/proptest):基于属性的测试,适用于 Rust。\n"
"* [rstest](https://docs.rs/rstest):支持固件和参数化测试。"
#: src/unsafe.md:1 #: src/unsafe.md:1
msgid "# Unsafe Rust" msgid "# Unsafe Rust"