Fixes to Generator tests (#1510)

* Remove unneeded report variable from generator tests.
* Fix missing message parameter in unittest_fail.  This was a compile error in Dart.
* Fix indentation in PHP.
* Equality helper function not needed in PHP.
This commit is contained in:
Neil Fraser
2017-12-12 17:38:38 -08:00
committed by GitHub
parent 0cb5dfc437
commit bc1a5baa48
5 changed files with 118 additions and 157 deletions

View File

@@ -59,13 +59,10 @@ Blockly.Python['unittest_main'] = function(block) {
// Run tests (unindented).
code += Blockly.Python.statementToCode(block, 'DO')
.replace(/^ /, '').replace(/\n /g, '\n');
var reportVar = Blockly.Python.variableDB_.getDistinctName(
'report', Blockly.Variables.NAME_TYPE);
code += reportVar + ' = ' + functionName + '()\n';
// Print the report.
code += 'print(' + functionName + '())\n';
// Destroy results.
code += resultsVar + ' = None\n';
// Print the report.
code += 'print(' + reportVar + ')\n';
return code;
};
@@ -121,8 +118,7 @@ Blockly.Python['unittest_fail'] = function(block) {
// Always assert an error.
var resultsVar = Blockly.Python.variableDB_.getName('unittestResults',
Blockly.Variables.NAME_TYPE);
var message = Blockly.Python.valueToCode(block, 'MESSAGE',
Blockly.Python.ORDER_NONE) || '';
var message = Blockly.Python.quote_(block.getFieldValue('MESSAGE'));
var functionName = Blockly.Python.provideFunction_(
'fail',
['def ' + Blockly.Python.FUNCTION_NAME_PLACEHOLDER_ + '(message):',