Skip to content

fix(#1656): update doc tests to use playground as the crate name #1934

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
Jun 10, 2025
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
12 changes: 6 additions & 6 deletions po/es.po
Original file line number Diff line number Diff line change
Expand Up @@ -14221,11 +14221,11 @@ msgid ""
"///\n"
"/// The next lines present detailed documentation. Code blocks start with\n"
"/// triple backquotes and have implicit `fn main()` inside\n"
"/// and `extern crate <cratename>`. Assume we're testing `doccomments` "
"crate:\n"
"/// and `extern crate <cratename>`. Assume we're testing a `playground` library\n"
"/// crate or using the Playground's Test action:\n"
"///\n"
"/// ```\n"
"/// let result = doccomments::add(2, 3);\n"
"/// let result = playground::add(2, 3);\n"
"/// assert_eq!(result, 5);\n"
"/// ```\n"
msgstr ""
Expand All @@ -14240,7 +14240,7 @@ msgid ""
"/// # Examples\n"
"///\n"
"/// ```\n"
"/// let result = doccomments::div(10, 2);\n"
"/// let result = playground::div(10, 2);\n"
"/// assert_eq!(result, 5);\n"
"/// ```\n"
"///\n"
Expand All @@ -14250,7 +14250,7 @@ msgid ""
"///\n"
"/// ```rust,should_panic\n"
"/// // panics on division by zero\n"
"/// doccomments::div(10, 0);\n"
"/// playground::div(10, 0);\n"
"/// ```\n"
msgstr ""

Expand Down Expand Up @@ -14285,7 +14285,7 @@ msgid ""
"/// # // hidden lines start with `#` symbol, but they're still compilable!\n"
"/// # fn try_main() -> Result<(), String> { // line that wraps the body "
"shown in doc\n"
"/// let res = doccomments::try_div(10, 2)?;\n"
"/// let res = playground::try_div(10, 2)?;\n"
"/// # Ok(()) // returning from try_main\n"
"/// # }\n"
"/// # fn main() { // starting main that'll unwrap()\n"
Expand Down
22 changes: 11 additions & 11 deletions po/ja.po
Original file line number Diff line number Diff line change
Expand Up @@ -16185,11 +16185,11 @@ msgid ""
"///\n"
"/// The next lines present detailed documentation. Code blocks start with\n"
"/// triple backquotes and have implicit `fn main()` inside\n"
"/// and `extern crate <cratename>`. Assume we're testing `doccomments` "
"crate:\n"
"/// and `extern crate <cratename>`. Assume we're testing a `playground` library\n"
"/// crate or using the Playground's Test action:\n"
"///\n"
"/// ```\n"
"/// let result = doccomments::add(2, 3);\n"
"/// let result = playground::add(2, 3);\n"
"/// assert_eq!(result, 5);\n"
"/// ```\n"
msgstr ""
Expand All @@ -16198,10 +16198,10 @@ msgstr ""
"/// 以降で詳細なドキュメンテーションを記述します。コードブロックは三重のバッ"
"ククォートで始まり、\n"
"/// 暗黙的に`fn main()`と`extern crate <クレート名>`で囲われます。\n"
"/// `doccomments`クレートをテストしたいときには、次のように記述します。\n"
"/// `playground`クレートをテストしたいときには、次のように記述します。\n"
"///\n"
"/// ```\n"
"/// let result = doccomments::add(2, 3);\n"
"/// let result = playground::add(2, 3);\n"
"/// assert_eq!(result, 5);\n"
"/// ```\n"

Expand All @@ -16215,7 +16215,7 @@ msgid ""
"/// # Examples\n"
"///\n"
"/// ```\n"
"/// let result = doccomments::div(10, 2);\n"
"/// let result = playground::div(10, 2);\n"
"/// assert_eq!(result, 5);\n"
"/// ```\n"
"///\n"
Expand All @@ -16225,7 +16225,7 @@ msgid ""
"///\n"
"/// ```rust,should_panic\n"
"/// // panics on division by zero\n"
"/// doccomments::div(10, 0);\n"
"/// playground::div(10, 0);\n"
"/// ```\n"
msgstr ""
"/// 一般的に、ドキュメンテーションコメントは\n"
Expand All @@ -16236,7 +16236,7 @@ msgstr ""
"/// # Examples\n"
"///\n"
"/// ```\n"
"/// let result = doccomments::div(10, 2);\n"
"/// let result = playground::div(10, 2);\n"
"/// assert_eq!(result, 5);\n"
"/// ```\n"
"///\n"
Expand All @@ -16246,7 +16246,7 @@ msgstr ""
"///\n"
"/// ```rust,should_panic\n"
"/// // ゼロで除算するとパニックします\n"
"/// doccomments::div(10, 0);\n"
"/// playground::div(10, 0);\n"
"/// ```\n"

#: src/testing/doc_testing.md:52
Expand Down Expand Up @@ -16291,7 +16291,7 @@ msgid ""
"/// # // hidden lines start with `#` symbol, but they're still compilable!\n"
"/// # fn try_main() -> Result<(), String> { // line that wraps the body "
"shown in doc\n"
"/// let res = doccomments::try_div(10, 2)?;\n"
"/// let res = playground::try_div(10, 2)?;\n"
"/// # Ok(()) // returning from try_main\n"
"/// # }\n"
"/// # fn main() { // starting main that'll unwrap()\n"
Expand All @@ -16305,7 +16305,7 @@ msgstr ""
"/// ```\n"
"/// # // 行頭に `#` を置くと行が隠されるが、コンパイルには成功します。\n"
"/// # fn try_main() -> Result<(), String> { // ドキュメントの本体を囲う行\n"
"/// let res = doccomments::try_div(10, 2)?;\n"
"/// let res = playground::try_div(10, 2)?;\n"
"/// # Ok(()) // try_mainから値を返します\n"
"/// # }\n"
"/// # fn main() { // unwrap()を実行します。\n"
Expand Down
22 changes: 11 additions & 11 deletions po/zh.po
Original file line number Diff line number Diff line change
Expand Up @@ -15454,22 +15454,22 @@ msgid ""
"///\n"
"/// The next lines present detailed documentation. Code blocks start with\n"
"/// triple backquotes and have implicit `fn main()` inside\n"
"/// and `extern crate <cratename>`. Assume we're testing `doccomments` "
"crate:\n"
"/// and `extern crate <cratename>`. Assume we're testing a `playground` library\n"
"/// crate or using the Playground's Test action:\n"
"///\n"
"/// ```\n"
"/// let result = doccomments::add(2, 3);\n"
"/// let result = playground::add(2, 3);\n"
"/// assert_eq!(result, 5);\n"
"/// ```\n"
msgstr ""
"/// 第一行是函数的简要描述。\n"
"///\n"
"/// 接下来的几行是详细文档。代码块以三个反引号开始,\n"
"/// 并隐含了 `fn main()` 函数和 `extern crate <cratename>` 声明。\n"
"/// 假设我们正在测试 `doccomments` crate:\n"
"/// 假设我们正在测试 `playground` crate:\n"
"///\n"
"/// ```\n"
"/// let result = doccomments::add(2, 3);\n"
"/// let result = playground::add(2, 3);\n"
"/// assert_eq!(result, 5);\n"
"/// ```\n"

Expand All @@ -15483,7 +15483,7 @@ msgid ""
"/// # Examples\n"
"///\n"
"/// ```\n"
"/// let result = doccomments::div(10, 2);\n"
"/// let result = playground::div(10, 2);\n"
"/// assert_eq!(result, 5);\n"
"/// ```\n"
"///\n"
Expand All @@ -15493,7 +15493,7 @@ msgid ""
"///\n"
"/// ```rust,should_panic\n"
"/// // panics on division by zero\n"
"/// doccomments::div(10, 0);\n"
"/// playground::div(10, 0);\n"
"/// ```\n"
msgstr ""
"/// 文档注释通常包含"示例"、"异常"和"错误"等部分。\n"
Expand All @@ -15503,7 +15503,7 @@ msgstr ""
"/// # 示例\n"
"///\n"
"/// ```\n"
"/// let result = doccomments::div(10, 2);\n"
"/// let result = playground::div(10, 2);\n"
"/// assert_eq!(result, 5);\n"
"/// ```\n"
"///\n"
Expand All @@ -15513,7 +15513,7 @@ msgstr ""
"///\n"
"/// ```rust,should_panic\n"
"/// // 除以零会触发异常\n"
"/// doccomments::div(10, 0);\n"
"/// playground::div(10, 0);\n"
"/// ```\n"

#: src/testing/doc_testing.md:52
Expand Down Expand Up @@ -15549,7 +15549,7 @@ msgid ""
"/// # // hidden lines start with `#` symbol, but they're still compilable!\n"
"/// # fn try_main() -> Result<(), String> { // line that wraps the body shown "
"in doc\n"
"/// let res = doccomments::try_div(10, 2)?;\n"
"/// let res = playground::try_div(10, 2)?;\n"
"/// # Ok(()) // returning from try_main\n"
"/// # }\n"
"/// # fn main() { // starting main that'll unwrap()\n"
Expand All @@ -15563,7 +15563,7 @@ msgstr ""
"/// ```\n"
"/// # // 以 `#` 开头的行在文档中是隐藏的,但它们仍然可以编译!\n"
"/// # fn try_main() -> Result<(), String> { // 这行包装了文档中显示的函数体\n"
"/// let res = doccomments::try_div(10, 2)?;\n"
"/// let res = playground::try_div(10, 2)?;\n"
"/// # Ok(()) // 从 try_main 返回\n"
"/// # }\n"
"/// # fn main() { // 开始会调用 unwrap() 的 main 函数\n"
Expand Down
13 changes: 7 additions & 6 deletions src/testing/doc_testing.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,11 @@ as documentation tests.
///
/// The next lines present detailed documentation. Code blocks start with
/// triple backquotes and have implicit `fn main()` inside
/// and `extern crate <cratename>`. Assume we're testing `doccomments` crate:
/// and `extern crate <cratename>`. Assume we're testing a `playground` library
/// crate or using the Playground's Test action:
///
/// ```
/// let result = doccomments::add(2, 3);
/// let result = playground::add(2, 3);
/// assert_eq!(result, 5);
/// ```
pub fn add(a: i32, b: i32) -> i32 {
Expand All @@ -28,7 +29,7 @@ pub fn add(a: i32, b: i32) -> i32 {
/// # Examples
///
/// ```
/// let result = doccomments::div(10, 2);
/// let result = playground::div(10, 2);
/// assert_eq!(result, 5);
/// ```
///
Expand All @@ -38,7 +39,7 @@ pub fn add(a: i32, b: i32) -> i32 {
///
/// ```rust,should_panic
/// // panics on division by zero
/// doccomments::div(10, 0);
/// playground::div(10, 0);
/// ```
pub fn div(a: i32, b: i32) -> i32 {
if b == 0 {
Expand All @@ -58,7 +59,7 @@ running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out

Doc-tests doccomments
Doc-tests playground

running 3 tests
test src/lib.rs - add (line 7) ... ok
Expand All @@ -84,7 +85,7 @@ and `unwrap` it in hidden `main`. Sounds complicated? Here's an example:
/// ```
/// # // hidden lines start with `#` symbol, but they're still compilable!
/// # fn try_main() -> Result<(), String> { // line that wraps the body shown in doc
/// let res = doccomments::try_div(10, 2)?;
/// let res = playground::try_div(10, 2)?;
/// # Ok(()) // returning from try_main
/// # }
/// # fn main() { // starting main that'll unwrap()
Expand Down