From e372129d0040435ca5f29dab21cd87c10cb64c74 Mon Sep 17 00:00:00 2001 From: Siddharth Parmar Date: Mon, 10 Sep 2018 06:38:34 +0530 Subject: [PATCH] Add tests for static math methods (#8626) --- .../math-undefined-version/input.js | 33 ++++++++++++ .../math-undefined-version/options.json | 8 +++ .../math-undefined-version/output.js | 51 +++++++++++++++++++ .../fixtures/runtime-corejs2/math/input.js | 33 ++++++++++++ .../runtime-corejs2/math/options.json | 9 ++++ .../fixtures/runtime-corejs2/math/output.js | 51 +++++++++++++++++++ 6 files changed, 185 insertions(+) create mode 100644 packages/babel-plugin-transform-runtime/test/fixtures/runtime-corejs2/math-undefined-version/input.js create mode 100644 packages/babel-plugin-transform-runtime/test/fixtures/runtime-corejs2/math-undefined-version/options.json create mode 100644 packages/babel-plugin-transform-runtime/test/fixtures/runtime-corejs2/math-undefined-version/output.js create mode 100644 packages/babel-plugin-transform-runtime/test/fixtures/runtime-corejs2/math/input.js create mode 100644 packages/babel-plugin-transform-runtime/test/fixtures/runtime-corejs2/math/options.json create mode 100644 packages/babel-plugin-transform-runtime/test/fixtures/runtime-corejs2/math/output.js diff --git a/packages/babel-plugin-transform-runtime/test/fixtures/runtime-corejs2/math-undefined-version/input.js b/packages/babel-plugin-transform-runtime/test/fixtures/runtime-corejs2/math-undefined-version/input.js new file mode 100644 index 000000000000..5355a96916ad --- /dev/null +++ b/packages/babel-plugin-transform-runtime/test/fixtures/runtime-corejs2/math-undefined-version/input.js @@ -0,0 +1,33 @@ +Math.acosh; + +Math.asinh; + +Math.atanh; + +Math.cbrt; + +Math.clz32; + +Math.cosh; + +Math.expm1; + +Math.fround; + +Math.hypot; + +Math.imul; + +Math.log10; + +Math.log1p; + +Math.log2; + +Math.sign; + +Math.sinh; + +Math.tanh; + +Math.trunc; diff --git a/packages/babel-plugin-transform-runtime/test/fixtures/runtime-corejs2/math-undefined-version/options.json b/packages/babel-plugin-transform-runtime/test/fixtures/runtime-corejs2/math-undefined-version/options.json new file mode 100644 index 000000000000..78d6f336fb59 --- /dev/null +++ b/packages/babel-plugin-transform-runtime/test/fixtures/runtime-corejs2/math-undefined-version/options.json @@ -0,0 +1,8 @@ +{ + "plugins": [ + ["transform-runtime", { + "corejs": 2 + }], + "transform-regenerator" + ] +} diff --git a/packages/babel-plugin-transform-runtime/test/fixtures/runtime-corejs2/math-undefined-version/output.js b/packages/babel-plugin-transform-runtime/test/fixtures/runtime-corejs2/math-undefined-version/output.js new file mode 100644 index 000000000000..7b773a5ec2fe --- /dev/null +++ b/packages/babel-plugin-transform-runtime/test/fixtures/runtime-corejs2/math-undefined-version/output.js @@ -0,0 +1,51 @@ +var _Math$trunc = require("@babel/runtime-corejs2/core-js/math/trunc"); + +var _Math$tanh = require("@babel/runtime-corejs2/core-js/math/tanh"); + +var _Math$sinh = require("@babel/runtime-corejs2/core-js/math/sinh"); + +var _Math$sign = require("@babel/runtime-corejs2/core-js/math/sign"); + +var _Math$log2 = require("@babel/runtime-corejs2/core-js/math/log2"); + +var _Math$log1p = require("@babel/runtime-corejs2/core-js/math/log1p"); + +var _Math$log = require("@babel/runtime-corejs2/core-js/math/log10"); + +var _Math$imul = require("@babel/runtime-corejs2/core-js/math/imul"); + +var _Math$hypot = require("@babel/runtime-corejs2/core-js/math/hypot"); + +var _Math$fround = require("@babel/runtime-corejs2/core-js/math/fround"); + +var _Math$expm = require("@babel/runtime-corejs2/core-js/math/expm1"); + +var _Math$cosh = require("@babel/runtime-corejs2/core-js/math/cosh"); + +var _Math$clz = require("@babel/runtime-corejs2/core-js/math/clz32"); + +var _Math$cbrt = require("@babel/runtime-corejs2/core-js/math/cbrt"); + +var _Math$atanh = require("@babel/runtime-corejs2/core-js/math/atanh"); + +var _Math$asinh = require("@babel/runtime-corejs2/core-js/math/asinh"); + +var _Math$acosh = require("@babel/runtime-corejs2/core-js/math/acosh"); + +_Math$acosh; +_Math$asinh; +_Math$atanh; +_Math$cbrt; +_Math$clz; +_Math$cosh; +_Math$expm; +_Math$fround; +_Math$hypot; +_Math$imul; +_Math$log; +_Math$log1p; +_Math$log2; +_Math$sign; +_Math$sinh; +_Math$tanh; +_Math$trunc; diff --git a/packages/babel-plugin-transform-runtime/test/fixtures/runtime-corejs2/math/input.js b/packages/babel-plugin-transform-runtime/test/fixtures/runtime-corejs2/math/input.js new file mode 100644 index 000000000000..5355a96916ad --- /dev/null +++ b/packages/babel-plugin-transform-runtime/test/fixtures/runtime-corejs2/math/input.js @@ -0,0 +1,33 @@ +Math.acosh; + +Math.asinh; + +Math.atanh; + +Math.cbrt; + +Math.clz32; + +Math.cosh; + +Math.expm1; + +Math.fround; + +Math.hypot; + +Math.imul; + +Math.log10; + +Math.log1p; + +Math.log2; + +Math.sign; + +Math.sinh; + +Math.tanh; + +Math.trunc; diff --git a/packages/babel-plugin-transform-runtime/test/fixtures/runtime-corejs2/math/options.json b/packages/babel-plugin-transform-runtime/test/fixtures/runtime-corejs2/math/options.json new file mode 100644 index 000000000000..e3297278a667 --- /dev/null +++ b/packages/babel-plugin-transform-runtime/test/fixtures/runtime-corejs2/math/options.json @@ -0,0 +1,9 @@ +{ + "plugins": [ + ["transform-runtime", { + "corejs": 2, + "version": "^7.0.1" + }], + "transform-regenerator" + ] +} diff --git a/packages/babel-plugin-transform-runtime/test/fixtures/runtime-corejs2/math/output.js b/packages/babel-plugin-transform-runtime/test/fixtures/runtime-corejs2/math/output.js new file mode 100644 index 000000000000..7b773a5ec2fe --- /dev/null +++ b/packages/babel-plugin-transform-runtime/test/fixtures/runtime-corejs2/math/output.js @@ -0,0 +1,51 @@ +var _Math$trunc = require("@babel/runtime-corejs2/core-js/math/trunc"); + +var _Math$tanh = require("@babel/runtime-corejs2/core-js/math/tanh"); + +var _Math$sinh = require("@babel/runtime-corejs2/core-js/math/sinh"); + +var _Math$sign = require("@babel/runtime-corejs2/core-js/math/sign"); + +var _Math$log2 = require("@babel/runtime-corejs2/core-js/math/log2"); + +var _Math$log1p = require("@babel/runtime-corejs2/core-js/math/log1p"); + +var _Math$log = require("@babel/runtime-corejs2/core-js/math/log10"); + +var _Math$imul = require("@babel/runtime-corejs2/core-js/math/imul"); + +var _Math$hypot = require("@babel/runtime-corejs2/core-js/math/hypot"); + +var _Math$fround = require("@babel/runtime-corejs2/core-js/math/fround"); + +var _Math$expm = require("@babel/runtime-corejs2/core-js/math/expm1"); + +var _Math$cosh = require("@babel/runtime-corejs2/core-js/math/cosh"); + +var _Math$clz = require("@babel/runtime-corejs2/core-js/math/clz32"); + +var _Math$cbrt = require("@babel/runtime-corejs2/core-js/math/cbrt"); + +var _Math$atanh = require("@babel/runtime-corejs2/core-js/math/atanh"); + +var _Math$asinh = require("@babel/runtime-corejs2/core-js/math/asinh"); + +var _Math$acosh = require("@babel/runtime-corejs2/core-js/math/acosh"); + +_Math$acosh; +_Math$asinh; +_Math$atanh; +_Math$cbrt; +_Math$clz; +_Math$cosh; +_Math$expm; +_Math$fround; +_Math$hypot; +_Math$imul; +_Math$log; +_Math$log1p; +_Math$log2; +_Math$sign; +_Math$sinh; +_Math$tanh; +_Math$trunc;