createCodeGenerationTestFn_ = (generator) => {
  return (testCase) => {
    return function () {
      const block = testCase.createBlock(this.workspace);
      let code;
      let innerOrder;
      if (testCase.useWorkspaceToCode) {
        code = generator.workspaceToCode(this.workspace);
      } else {
        generator.init(this.workspace);
        code = generator.blockToCode(block);
        if (Array.isArray(code)) {
          innerOrder = code[1];
          code = code[0];
        }
      }
      const assertFunc =
        typeof testCase.expectedCode === 'string' ? assert.equal : assert.match;
      assertFunc(code, testCase.expectedCode);
      if (
        !testCase.useWorkspaceToCode &&
        testCase.expectedInnerOrder !== undefined
      ) {
        assert.equal(innerOrder, testCase.expectedInnerOrder);
      }
    };
  };
}
Returns mocha test callback for code generation based on provided
   generator.
@param {!Blockly.Generator} generator The generator to use in test.
@returns {function(!CodeGenerationTestCase):!Function} Function that
   returns mocha test callback based on test case.
@private