All files / es5/tests/common functions.js

80.95% Statements 85/105
53.06% Branches 26/49
90% Functions 18/20
95.45% Lines 84/88
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238    12x           12x       6x     6x     6x     6x     6x     6x     6x     6x   6x     7x 21x 21x   7x 7x     7x       7x             5x 15x 15x   5x 5x     5x       5x               4x 16x 16x   4x 4x     4x 4x 4x     4x 4x             4x                 4x 12x 12x   4x 4x     4x 4x 4x 4x 4x             4x                 4x 16x 16x   4x 4x     4x 4x 4x 4x 4x 4x     4x 4x 4x 4x 4x                 4x             4x 12x 12x   4x 4x     4x       4x             9x 18x 18x   9x 9x             9x             1x 2x 2x   1x 1x             1x           6x                    
"use strict";
 
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest(); }
 
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance"); }
 
function _iterableToArrayLimit(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
 
function _arrayWithHoles(arr) { Eif (Array.isArray(arr)) return arr; }
 
var _marked =
/*#__PURE__*/
regeneratorRuntime.mark(basic),
    _marked2 =
/*#__PURE__*/
regeneratorRuntime.mark(basicMultiArg),
    _marked3 =
/*#__PURE__*/
regeneratorRuntime.mark(basicMultistep),
    _marked4 =
/*#__PURE__*/
regeneratorRuntime.mark(basicParallel),
    _marked5 =
/*#__PURE__*/
regeneratorRuntime.mark(basicMultistepParallel),
    _marked6 =
/*#__PURE__*/
regeneratorRuntime.mark(basicEmpty),
    _marked7 =
/*#__PURE__*/
regeneratorRuntime.mark(usesThrowingInterpreter),
    _marked8 =
/*#__PURE__*/
regeneratorRuntime.mark(usesRejectingInterpreter);
 
var cmds = require("./cmds");
 
function basic(message) {
  return regeneratorRuntime.wrap(function basic$(_context) {
    while (1) {
      switch (_context.prev = _context.next) {
        case 0:
          _context.next = 2;
          return cmds.echo(message);
 
        case 2:
          return _context.abrupt("return", _context.sent);
 
        case 3:
        case "end":
          return _context.stop();
      }
    }
  }, _marked, this);
}
 
function basicMultiArg(a, b) {
  return regeneratorRuntime.wrap(function basicMultiArg$(_context2) {
    while (1) {
      switch (_context2.prev = _context2.next) {
        case 0:
          _context2.next = 2;
          return cmds.echo(a + b);
 
        case 2:
          return _context2.abrupt("return", _context2.sent);
 
        case 3:
        case "end":
          return _context2.stop();
      }
    }
  }, _marked2, this);
}
 
function basicMultistep(message) {
  var s1, s2;
  return regeneratorRuntime.wrap(function basicMultistep$(_context3) {
    while (1) {
      switch (_context3.prev = _context3.next) {
        case 0:
          _context3.next = 2;
          return cmds.echo(message + "1");
 
        case 2:
          s1 = _context3.sent;
          _context3.next = 5;
          return cmds.echo(message + "2");
 
        case 5:
          s2 = _context3.sent;
          return _context3.abrupt("return", {
            s1: s1,
            s2: s2
          });
 
        case 7:
        case "end":
          return _context3.stop();
      }
    }
  }, _marked3, this);
}
 
function basicParallel(message) {
  var _ref, _ref2, s1, s2;
 
  return regeneratorRuntime.wrap(function basicParallel$(_context4) {
    while (1) {
      switch (_context4.prev = _context4.next) {
        case 0:
          _context4.next = 2;
          return [cmds.echo(message), cmds.echo(message)];
 
        case 2:
          _ref = _context4.sent;
          _ref2 = _slicedToArray(_ref, 2);
          s1 = _ref2[0];
          s2 = _ref2[1];
          return _context4.abrupt("return", {
            s1: s1 + "1",
            s2: s2 + "2"
          });
 
        case 7:
        case "end":
          return _context4.stop();
      }
    }
  }, _marked4, this);
}
 
function basicMultistepParallel(message) {
  var _ref3, _ref4, s1, s2, _ref5, _ref6, s3, s4;
 
  return regeneratorRuntime.wrap(function basicMultistepParallel$(_context5) {
    while (1) {
      switch (_context5.prev = _context5.next) {
        case 0:
          _context5.next = 2;
          return [cmds.echo(message), cmds.echo(message)];
 
        case 2:
          _ref3 = _context5.sent;
          _ref4 = _slicedToArray(_ref3, 2);
          s1 = _ref4[0];
          s2 = _ref4[1];
          _context5.next = 8;
          return [cmds.echo(message), cmds.echo(message)];
 
        case 8:
          _ref5 = _context5.sent;
          _ref6 = _slicedToArray(_ref5, 2);
          s3 = _ref6[0];
          s4 = _ref6[1];
          return _context5.abrupt("return", {
            s1: s1 + "1",
            s2: s2 + "2",
            s3: s3 + "3",
            s4: s4 + "4"
          });
 
        case 13:
        case "end":
          return _context5.stop();
      }
    }
  }, _marked5, this);
}
 
function basicEmpty() {
  return regeneratorRuntime.wrap(function basicEmpty$(_context6) {
    while (1) {
      switch (_context6.prev = _context6.next) {
        case 0:
          _context6.next = 2;
          return [];
 
        case 2:
          return _context6.abrupt("return", _context6.sent);
 
        case 3:
        case "end":
          return _context6.stop();
      }
    }
  }, _marked6, this);
}
 
function usesThrowingInterpreter() {
  return regeneratorRuntime.wrap(function usesThrowingInterpreter$(_context7) {
    while (1) {
      switch (_context7.prev = _context7.next) {
        case 0:
          _context7.next = 2;
          return cmds.die("oops");
 
        case 2:
          return _context7.abrupt("return", _context7.sent);
 
        case 3:
        case "end":
          return _context7.stop();
      }
    }
  }, _marked7, this);
}
 
function usesRejectingInterpreter() {
  return regeneratorRuntime.wrap(function usesRejectingInterpreter$(_context8) {
    while (1) {
      switch (_context8.prev = _context8.next) {
        case 0:
          _context8.next = 2;
          return cmds.dieFromRejection("oops");
 
        case 2:
          return _context8.abrupt("return", _context8.sent);
 
        case 3:
        case "end":
          return _context8.stop();
      }
    }
  }, _marked8, this);
}
 
module.exports = {
  basic: basic,
  basicMultiArg: basicMultiArg,
  basicMultistep: basicMultistep,
  basicParallel: basicParallel,
  basicMultistepParallel: basicMultistepParallel,
  basicEmpty: basicEmpty,
  usesThrowingInterpreter: usesThrowingInterpreter,
  usesRejectingInterpreter: usesRejectingInterpreter
};
//# sourceMappingURL=functions.js.map