fix(i18n): chinese test suite (#38220)
* fix: Chinese test suite Add localeTiltes, descriptions, and adjust test text and testStrings to get the automated test suite working. * fix: ran script, updated testStrings and solutions
This commit is contained in:
committed by
Mrugesh Mohapatra
parent
6a7a7e6d7d
commit
b3213fc892
@ -18,9 +18,9 @@ localeTitle: 调用函数时捕获以错误顺序传递的参数
|
||||
```yml
|
||||
tests:
|
||||
- text: 你的代码应该固定可变<code>power</code>因此它等于2提升到3功率,而不是3增加到2功率。
|
||||
testString: 'assert(power == 8, "Your code should fix the variable <code>power</code> so it equals 2 raised to the 3rd power, not 3 raised to the 2nd power.");'
|
||||
testString: assert(power == 8);
|
||||
- text: 您的代码应使用<code>raiseToPower</code>函数调用的正确参数顺序。
|
||||
testString: 'assert(code.match(/raiseToPower\(\s*?base\s*?,\s*?exp\s*?\);/g), "Your code should use the correct order of the arguments for the <code>raiseToPower</code> function call.");'
|
||||
testString: assert(code.match(/raiseToPower\(\s*?base\s*?,\s*?exp\s*?\);/g));
|
||||
|
||||
```
|
||||
|
||||
|
@ -18,9 +18,9 @@ localeTitle: 在函数调用后捕获缺失的打开和关闭括号
|
||||
```yml
|
||||
tests:
|
||||
- text: 您的代码应修复变量<code>result</code>以便将其设置为函数<code>getNine</code>返回的数字。
|
||||
testString: 'assert(result == 9, "Your code should fix the variable <code>result</code> so it is set to the number that the function <code>getNine</code> returns.");'
|
||||
testString: assert(result == 9);
|
||||
- text: 您的代码应该调用<code>getNine</code>函数。
|
||||
testString: 'assert(code.match(/getNine\(\)/g).length == 2, "Your code should call the <code>getNine</code> function.");'
|
||||
testString: assert(code.match(/getNine\(\)/g).length == 2);
|
||||
|
||||
```
|
||||
|
||||
|
@ -18,15 +18,15 @@ localeTitle: 捕获拼错的变量和函数名称
|
||||
```yml
|
||||
tests:
|
||||
- text: 检查netWorkingCapital计算中使用的两个变量的拼写,控制台输出应显示“净营运资金为:2”。
|
||||
testString: 'assert(netWorkingCapital === 2, "Check the spelling of the two variables used in the netWorkingCapital calculation, the console output should show that "Net working capital is: 2".");'
|
||||
testString: 'assert(netWorkingCapital === 2);'
|
||||
- text: 代码中不应存在拼写错误的变量。
|
||||
testString: 'assert(!code.match(/recievables/g), "There should be no instances of mis-spelled variables in the code.");'
|
||||
testString: assert(!code.match(/recievables/g));
|
||||
- text: <code>receivables</code>在代码中声明并正确使用应<code>receivables</code>变量。
|
||||
testString: 'assert(code.match(/receivables/g).length == 2, "The <code>receivables</code> variable should be declared and used properly in the code.");'
|
||||
testString: assert(code.match(/receivables/g).length == 2);
|
||||
- text: 代码中不应存在拼写错误的变量。
|
||||
testString: 'assert(!code.match(/payable;/g), "There should be no instances of mis-spelled variables in the code.");'
|
||||
testString: assert(!code.match(/payable;/g));
|
||||
- text: 应在组织中声明并正确使用<code>payables</code>变量。
|
||||
testString: 'assert(code.match(/payables/g).length == 2, "The <code>payables</code> variable should be declared and used properly in the code.");'
|
||||
testString: assert(code.match(/payables/g).length == 2);
|
||||
|
||||
```
|
||||
|
||||
|
@ -18,9 +18,9 @@ localeTitle: 抓住单引号和双引号的混合使用
|
||||
```yml
|
||||
tests:
|
||||
- text: '您的代码应该通过更改或转义它们来修复<code>href</code>值“#Home”周围的引号。'
|
||||
testString: 'assert(code.match(/<a href=\s*?("|\\")#Home\1\s*?>/g), "Your code should fix the quotes around the <code>href</code> value "#Home" by either changing or escaping them.");'
|
||||
testString: assert(code.match(/<a href=\s*?('|\\")#Home\1\s*?>/g));
|
||||
- text: 您的代码应该在整个字符串周围保留双引号。
|
||||
testString: 'assert(code.match(/"<p>.*?<\/p>";/g), "Your code should keep the double quotes around the entire string.");'
|
||||
testString: assert(code.match(/"<p>.*?<\/p>";/g));
|
||||
|
||||
```
|
||||
|
||||
|
@ -18,13 +18,13 @@ localeTitle: 使用索引时捕获一个错误
|
||||
```yml
|
||||
tests:
|
||||
- text: 您的代码应该设置循环的初始条件,以便从第一个索引开始。
|
||||
testString: 'assert(code.match(/i\s*?=\s*?0\s*?;/g).length == 1, "Your code should set the initial condition of the loop so it starts at the first index.");'
|
||||
testString: assert(code.match(/i\s*?=\s*?0\s*?;/g).length == 1);
|
||||
- text: 您的代码应该修复循环的初始条件,以便索引从0开始。
|
||||
testString: 'assert(!code.match(/i\s?=\s*?1\s*?;/g), "Your code should fix the initial condition of the loop so that the index starts at 0.");'
|
||||
testString: assert(!code.match(/i\s?=\s*?1\s*?;/g));
|
||||
- text: 您的代码应设置循环的终端条件,以便它停在最后一个索引处。
|
||||
testString: 'assert(code.match(/i\s*?<\s*?len\s*?;/g).length == 1, "Your code should set the terminal condition of the loop so it stops at the last index.");'
|
||||
testString: assert(code.match(/i\s*?<\s*?len\s*?;/g).length == 1);
|
||||
- text: 您的代码应该修复循环的终端条件,使其在长度之前停止在1。
|
||||
testString: 'assert(!code.match(/i\s*?<=\s*?len;/g), "Your code should fix the terminal condition of the loop so that it stops at 1 before the length.");'
|
||||
testString: assert(!code.match(/i\s*?<=\s*?len;/g));
|
||||
|
||||
```
|
||||
|
||||
|
@ -18,9 +18,9 @@ localeTitle: 抓住未封闭的圆括号,括号,括号和引号
|
||||
```yml
|
||||
tests:
|
||||
- text: 您的代码应该修复数组中缺少的部分。
|
||||
testString: 'assert(code.match(/myArray\s*?=\s*?\[\s*?1\s*?,\s*?2\s*?,\s*?3\s*?\];/g), "Your code should fix the missing piece of the array.");'
|
||||
testString: assert(code.match(/myArray\s*?=\s*?\[\s*?1\s*?,\s*?2\s*?,\s*?3\s*?\];/g));
|
||||
- text: 您的代码应该修复<code>.reduce()</code>方法的缺失部分。控制台输出应显示“数组值的总和为:6”。
|
||||
testString: 'assert(arraySum === 6, "Your code should fix the missing piece of the <code>.reduce()</code> method. The console output should show that "Sum of array values is: 6".");'
|
||||
testString: 'assert(arraySum === 6);'
|
||||
|
||||
```
|
||||
|
||||
|
@ -18,9 +18,9 @@ localeTitle: 捕获使用赋值运算符而不是等式运算符
|
||||
```yml
|
||||
tests:
|
||||
- text: 您的代码应该修复条件,以便检查是否相等,而不是使用赋值。
|
||||
testString: 'assert(result == "Not equal!", "Your code should fix the condition so it checks for equality, instead of using assignment.");'
|
||||
testString: assert(result == "Not equal!");
|
||||
- text: 条件可以使用<code>==</code>或<code>===</code>来测试相等性。
|
||||
testString: 'assert(code.match(/x\s*?===?\s*?y/g), "The condition can use either <code>==</code> or <code>===</code> to test for equality.");'
|
||||
testString: assert(code.match(/x\s*?===?\s*?y/g));
|
||||
|
||||
```
|
||||
|
||||
|
@ -18,9 +18,9 @@ localeTitle: 使用有效的终端条件防止无限循环
|
||||
```yml
|
||||
tests:
|
||||
- text: 您的代码应该更改<code>for</code>循环的终端条件(中间部分)中的比较运算符。
|
||||
testString: 'assert(code.match(/i\s*?<=\s*?4;/g).length == 1, "Your code should change the comparison operator in the terminal condition (the middle part) of the <code>for</code> loop.");'
|
||||
testString: assert(code.match(/i\s*?<=\s*?4;/g).length == 1);
|
||||
- text: 您的代码应该在循环的终端条件中修复比较运算符。
|
||||
testString: 'assert(!code.match(/i\s*?!=\s*?4;/g), "Your code should fix the comparison operator in the terminal condition of the loop.");'
|
||||
testString: assert(!code.match(/i\s*?!=\s*?4;/g));
|
||||
|
||||
```
|
||||
|
||||
|
@ -18,11 +18,11 @@ localeTitle: 在循环内重新初始化变量时请小心
|
||||
```yml
|
||||
tests:
|
||||
- text: 您的代码应该将<code>matrix</code>变量设置为一个数组,每个数组包含3行,每列2列零。
|
||||
testString: 'assert(JSON.stringify(matrix) == "[[0,0],[0,0],[0,0]]", "Your code should set the <code>matrix</code> variable to an array holding 3 rows of 2 columns of zeroes each.");'
|
||||
testString: assert(JSON.stringify(matrix) == "[[0,0],[0,0],[0,0]]");
|
||||
- text: <code>matrix</code>变量应该有3行。
|
||||
testString: 'assert(matrix.length == 3, "The <code>matrix</code> variable should have 3 rows.");'
|
||||
testString: assert(matrix.length == 3);
|
||||
- text: <code>matrix</code>变量每行应有2列。
|
||||
testString: 'assert(matrix[0].length == 2 && matrix[1].length === 2 && matrix[2].length === 2, "The <code>matrix</code> variable should have 2 columns in each row.");'
|
||||
testString: assert(matrix[0].length == 2 && matrix[1].length === 2 && matrix[2].length === 2);
|
||||
|
||||
```
|
||||
|
||||
|
@ -18,7 +18,7 @@ localeTitle: 使用JavaScript控制台检查变量的值
|
||||
```yml
|
||||
tests:
|
||||
- text: 您的代码应使用<code>console.log()</code>来检查变量<code>a</code>的值。
|
||||
testString: 'assert(code.match(/console\.log\(a\)/g), "Your code should use <code>console.log()</code> to check the value of the variable <code>a</code>.");'
|
||||
testString: assert(code.match(/console\.log\(a\)/g));
|
||||
|
||||
```
|
||||
|
||||
|
@ -18,11 +18,11 @@ localeTitle: 使用typeof检查变量的类型
|
||||
```yml
|
||||
tests:
|
||||
- text: 您的代码应在两个<code>console.log()</code>语句中使用<code>typeof</code>来检查变量的类型。
|
||||
testString: 'assert(code.match(/console\.log\(typeof[\( ].*\)?\)/g).length == 2, "Your code should use <code>typeof</code> in two <code>console.log()</code> statements to check the type of the variables.");'
|
||||
testString: assert(code.match(/console\.log\(typeof[\( ].*\)?\)/g).length == 2);
|
||||
- text: 您的代码应使用<code>typeof</code>来检查变量类型<code>seven</code> 。
|
||||
testString: 'assert(code.match(/typeof[\( ]seven\)?/g), "Your code should use <code>typeof</code> to check the type of the variable <code>seven</code>.");'
|
||||
testString: assert(code.match(/typeof[\( ]seven\)?/g));
|
||||
- text: 您的代码应使用<code>typeof</code>来检查变量的类型<code>three</code> 。
|
||||
testString: 'assert(code.match(/typeof[\( ]three\)?/g), "Your code should use <code>typeof</code> to check the type of the variable <code>three</code>.");'
|
||||
testString: assert(code.match(/typeof[\( ]three\)?/g));
|
||||
|
||||
```
|
||||
|
||||
|
Reference in New Issue
Block a user