mirror of
https://github.com/google/blockly.git
synced 2026-01-04 23:50:12 +01:00
Add suite name to generator tests
This commit is contained in:
@@ -60,6 +60,7 @@
|
|||||||
</statement>
|
</statement>
|
||||||
</block>
|
</block>
|
||||||
<block type="unittest_main" x="-5" y="49">
|
<block type="unittest_main" x="-5" y="49">
|
||||||
|
<field name="SUITE_NAME">Colour</field>
|
||||||
<statement name="DO">
|
<statement name="DO">
|
||||||
<block type="procedures_callnoreturn">
|
<block type="procedures_callnoreturn">
|
||||||
<mutation name="test colour picker"></mutation>
|
<mutation name="test colour picker"></mutation>
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
<xml xmlns="http://www.w3.org/1999/xhtml">
|
<xml xmlns="http://www.w3.org/1999/xhtml">
|
||||||
<!-- Do not include <variables> here to test backward compatibility. -->
|
<!-- Do not include <variables> here to test backward compatibility. -->
|
||||||
<block type="unittest_main" x="0" y="1">
|
<block type="unittest_main" x="0" y="1">
|
||||||
|
<field name="SUITE_NAME">Functions</field>
|
||||||
<statement name="DO">
|
<statement name="DO">
|
||||||
<block type="procedures_callnoreturn">
|
<block type="procedures_callnoreturn">
|
||||||
<mutation name="test procedure"></mutation>
|
<mutation name="test procedure"></mutation>
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
<xml xmlns="http://www.w3.org/1999/xhtml">
|
<xml xmlns="http://www.w3.org/1999/xhtml">
|
||||||
<block type="unittest_main" x="13" y="13">
|
<block type="unittest_main" x="13" y="13">
|
||||||
|
<field name="SUITE_NAME">Lists</field>
|
||||||
<statement name="DO">
|
<statement name="DO">
|
||||||
<block type="procedures_callnoreturn">
|
<block type="procedures_callnoreturn">
|
||||||
<mutation name="test create"></mutation>
|
<mutation name="test create"></mutation>
|
||||||
@@ -8281,4 +8282,4 @@
|
|||||||
</block>
|
</block>
|
||||||
</statement>
|
</statement>
|
||||||
</block>
|
</block>
|
||||||
</xml>
|
</xml>
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
<xml xmlns="http://www.w3.org/1999/xhtml">
|
<xml xmlns="http://www.w3.org/1999/xhtml">
|
||||||
<block type="unittest_main" x="-13" y="-13">
|
<block type="unittest_main" x="-13" y="-13">
|
||||||
|
<field name="SUITE_NAME">Logic</field>
|
||||||
<statement name="DO">
|
<statement name="DO">
|
||||||
<block type="unittest_assertvalue" inline="false">
|
<block type="unittest_assertvalue" inline="false">
|
||||||
<field name="EXPECTED">TRUE</field>
|
<field name="EXPECTED">TRUE</field>
|
||||||
@@ -1015,4 +1016,4 @@
|
|||||||
</block>
|
</block>
|
||||||
</statement>
|
</statement>
|
||||||
</block>
|
</block>
|
||||||
</xml>
|
</xml>
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
<xml xmlns="http://www.w3.org/1999/xhtml">
|
<xml xmlns="http://www.w3.org/1999/xhtml">
|
||||||
<block type="unittest_main" x="33" y="140">
|
<block type="unittest_main" x="33" y="140">
|
||||||
|
<field name="SUITE_NAME">Loops 1</field>
|
||||||
<statement name="DO">
|
<statement name="DO">
|
||||||
<block type="procedures_callnoreturn">
|
<block type="procedures_callnoreturn">
|
||||||
<mutation name="test repeat"></mutation>
|
<mutation name="test repeat"></mutation>
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
<xml xmlns="http://www.w3.org/1999/xhtml">
|
<xml xmlns="http://www.w3.org/1999/xhtml">
|
||||||
<block type="unittest_main" x="66" y="-2">
|
<block type="unittest_main" x="66" y="-2">
|
||||||
|
<field name="SUITE_NAME">Loops 2</field>
|
||||||
<statement name="DO">
|
<statement name="DO">
|
||||||
<block type="procedures_callnoreturn">
|
<block type="procedures_callnoreturn">
|
||||||
<mutation name="test count"></mutation>
|
<mutation name="test count"></mutation>
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
<xml xmlns="http://www.w3.org/1999/xhtml">
|
<xml xmlns="http://www.w3.org/1999/xhtml">
|
||||||
<block type="unittest_main" x="19" y="106">
|
<block type="unittest_main" x="19" y="106">
|
||||||
|
<field name="SUITE_NAME">Loops 3</field>
|
||||||
<statement name="DO">
|
<statement name="DO">
|
||||||
<block type="procedures_callnoreturn">
|
<block type="procedures_callnoreturn">
|
||||||
<mutation name="test break"></mutation>
|
<mutation name="test break"></mutation>
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
<xml xmlns="http://www.w3.org/1999/xhtml">
|
<xml xmlns="http://www.w3.org/1999/xhtml">
|
||||||
<block type="unittest_main" x="13" y="13">
|
<block type="unittest_main" x="13" y="13">
|
||||||
|
<field name="SUITE_NAME">Math</field>
|
||||||
<statement name="DO">
|
<statement name="DO">
|
||||||
<block type="procedures_callnoreturn">
|
<block type="procedures_callnoreturn">
|
||||||
<mutation name="test arithmetic"></mutation>
|
<mutation name="test arithmetic"></mutation>
|
||||||
@@ -1946,4 +1947,4 @@
|
|||||||
</block>
|
</block>
|
||||||
</statement>
|
</statement>
|
||||||
</block>
|
</block>
|
||||||
</xml>
|
</xml>
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
<xml xmlns="http://www.w3.org/1999/xhtml">
|
<xml xmlns="http://www.w3.org/1999/xhtml">
|
||||||
<block type="unittest_main" x="13" y="-63">
|
<block type="unittest_main" x="13" y="-63">
|
||||||
|
<field name="SUITE_NAME">Text</field>
|
||||||
<statement name="DO">
|
<statement name="DO">
|
||||||
<block type="procedures_callnoreturn">
|
<block type="procedures_callnoreturn">
|
||||||
<mutation name="test length"></mutation>
|
<mutation name="test length"></mutation>
|
||||||
@@ -4647,4 +4648,4 @@
|
|||||||
</block>
|
</block>
|
||||||
</statement>
|
</statement>
|
||||||
</block>
|
</block>
|
||||||
</xml>
|
</xml>
|
||||||
|
|||||||
@@ -29,7 +29,8 @@ Blockly.Blocks['unittest_main'] = {
|
|||||||
init: function() {
|
init: function() {
|
||||||
this.setColour(65);
|
this.setColour(65);
|
||||||
this.appendDummyInput()
|
this.appendDummyInput()
|
||||||
.appendField('run tests');
|
.appendField('run test suite')
|
||||||
|
.appendField(new Blockly.FieldTextInput(''), 'SUITE_NAME');
|
||||||
this.appendStatementInput('DO');
|
this.appendStatementInput('DO');
|
||||||
this.setTooltip('Executes the enclosed unit tests,\n' +
|
this.setTooltip('Executes the enclosed unit tests,\n' +
|
||||||
'then prints a summary.');
|
'then prints a summary.');
|
||||||
|
|||||||
@@ -59,6 +59,11 @@ Blockly.Dart['unittest_main'] = function(block) {
|
|||||||
'}']);
|
'}']);
|
||||||
// Setup global to hold test results.
|
// Setup global to hold test results.
|
||||||
var code = resultsVar + ' = [];\n';
|
var code = resultsVar + ' = [];\n';
|
||||||
|
// Say which test suite this is.
|
||||||
|
code += 'print(\'\\n====================\\n\\n' +
|
||||||
|
'Running suite: ' +
|
||||||
|
block.getFieldValue('SUITE_NAME') +
|
||||||
|
'\');\n';
|
||||||
// Run tests (unindented).
|
// Run tests (unindented).
|
||||||
code += Blockly.Dart.statementToCode(block, 'DO')
|
code += Blockly.Dart.statementToCode(block, 'DO')
|
||||||
.replace(/^ /, '').replace(/\n /g, '\n');
|
.replace(/^ /, '').replace(/\n /g, '\n');
|
||||||
|
|||||||
@@ -60,6 +60,11 @@ Blockly.JavaScript['unittest_main'] = function(block) {
|
|||||||
'}']);
|
'}']);
|
||||||
// Setup global to hold test results.
|
// Setup global to hold test results.
|
||||||
var code = resultsVar + ' = [];\n';
|
var code = resultsVar + ' = [];\n';
|
||||||
|
// Say which test suite this is.
|
||||||
|
code += 'console.log(\'\\n====================\\n\\n' +
|
||||||
|
'Running suite: ' +
|
||||||
|
block.getFieldValue('SUITE_NAME') +
|
||||||
|
'\')\n';
|
||||||
// Run tests (unindented).
|
// Run tests (unindented).
|
||||||
code += Blockly.JavaScript.statementToCode(block, 'DO')
|
code += Blockly.JavaScript.statementToCode(block, 'DO')
|
||||||
.replace(/^ /, '').replace(/\n /g, '\n');
|
.replace(/^ /, '').replace(/\n /g, '\n');
|
||||||
|
|||||||
@@ -58,6 +58,11 @@ Blockly.Lua['unittest_main'] = function(block) {
|
|||||||
'end']);
|
'end']);
|
||||||
// Setup global to hold test results.
|
// Setup global to hold test results.
|
||||||
var code = resultsVar + ' = {}\n';
|
var code = resultsVar + ' = {}\n';
|
||||||
|
// Say which test suite this is.
|
||||||
|
code += 'print(\'\\n====================\\n\\n' +
|
||||||
|
'Running suite: ' +
|
||||||
|
block.getFieldValue('SUITE_NAME') +
|
||||||
|
'\')\n';
|
||||||
// Run tests (unindented).
|
// Run tests (unindented).
|
||||||
code += Blockly.Lua.statementToCode(block, 'DO')
|
code += Blockly.Lua.statementToCode(block, 'DO')
|
||||||
.replace(/^ /, '').replace(/\n /g, '\n');
|
.replace(/^ /, '').replace(/\n /g, '\n');
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ Blockly.PHP['unittest_main'] = function(block) {
|
|||||||
' array_push($report, "Number of tests run: " . count(' + resultsVar + '));',
|
' array_push($report, "Number of tests run: " . count(' + resultsVar + '));',
|
||||||
' array_push($report, "");',
|
' array_push($report, "");',
|
||||||
' if ($fails) {',
|
' if ($fails) {',
|
||||||
' array_push($report, "FAILED (failures=" . $fails + ")");',
|
' array_push($report, "FAILED (failures=" . $fails . ")");',
|
||||||
' } else {',
|
' } else {',
|
||||||
' array_push($report, "OK");',
|
' array_push($report, "OK");',
|
||||||
' }',
|
' }',
|
||||||
@@ -60,6 +60,11 @@ Blockly.PHP['unittest_main'] = function(block) {
|
|||||||
'}']);
|
'}']);
|
||||||
// Setup global to hold test results.
|
// Setup global to hold test results.
|
||||||
var code = resultsVar + ' = array();\n';
|
var code = resultsVar + ' = array();\n';
|
||||||
|
// Say which test suite this is.
|
||||||
|
code += 'print("\\n====================\\n\\n' +
|
||||||
|
'Running suite: ' +
|
||||||
|
block.getFieldValue('SUITE_NAME') +
|
||||||
|
'\\n");\n';
|
||||||
// Run tests (unindented).
|
// Run tests (unindented).
|
||||||
code += Blockly.PHP.statementToCode(block, 'DO')
|
code += Blockly.PHP.statementToCode(block, 'DO')
|
||||||
.replace(/^ /, '').replace(/\n /g, '\n');
|
.replace(/^ /, '').replace(/\n /g, '\n');
|
||||||
|
|||||||
@@ -56,6 +56,11 @@ Blockly.Python['unittest_main'] = function(block) {
|
|||||||
|
|
||||||
// Setup global to hold test results.
|
// Setup global to hold test results.
|
||||||
var code = resultsVar + ' = []\n';
|
var code = resultsVar + ' = []\n';
|
||||||
|
// Say which test suite this is.
|
||||||
|
code += 'print(\'\\n====================\\n\\n' +
|
||||||
|
'Running suite: ' +
|
||||||
|
block.getFieldValue('SUITE_NAME') +
|
||||||
|
'\')\n';
|
||||||
// Run tests (unindented).
|
// Run tests (unindented).
|
||||||
code += Blockly.Python.statementToCode(block, 'DO')
|
code += Blockly.Python.statementToCode(block, 'DO')
|
||||||
.replace(/^ /, '').replace(/\n /g, '\n');
|
.replace(/^ /, '').replace(/\n /g, '\n');
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
<xml xmlns="http://www.w3.org/1999/xhtml">
|
<xml xmlns="http://www.w3.org/1999/xhtml">
|
||||||
<!-- Do not include <variables> here to test backward compatibility. -->
|
<!-- Do not include <variables> here to test backward compatibility. -->
|
||||||
<block type="unittest_main" x="0" y="0">
|
<block type="unittest_main" x="0" y="0">
|
||||||
|
<field name="SUITE_NAME">Variables</field>
|
||||||
<statement name="DO">
|
<statement name="DO">
|
||||||
<block type="variables_set" inline="false">
|
<block type="variables_set" inline="false">
|
||||||
<field name="VAR">item</field>
|
<field name="VAR">item</field>
|
||||||
|
|||||||
Reference in New Issue
Block a user