From 6f5df0e2b6b7db252e28ce80ebc54814fdc61497 Mon Sep 17 00:00:00 2001 From: Christopher Chedeau Date: Fri, 13 Jan 2017 20:17:02 -0800 Subject: [PATCH] Change test to workaround babylon bug (#184) Babylon has a bug where it doesn't escape DirectiveLiteral properly. Except for `'use strict';`, this never happens in real world code, so let's put strings in a array in order to workaround this bug and have the same output on both parsers. https://github.com/babel/babylon/issues/289 --- .../strings/__snapshots__/jsfmt.spec.js.snap | 70 +++++++++---------- tests/strings/strings.js | 32 +++++---- 2 files changed, 51 insertions(+), 51 deletions(-) diff --git a/tests/strings/__snapshots__/jsfmt.spec.js.snap b/tests/strings/__snapshots__/jsfmt.spec.js.snap index 2edc67b56..3e21efa76 100644 --- a/tests/strings/__snapshots__/jsfmt.spec.js.snap +++ b/tests/strings/__snapshots__/jsfmt.spec.js.snap @@ -1,46 +1,44 @@ exports[`test strings.js 1`] = ` -"\"abc\" -\'abc\' +"[ + \"abc\", + \'abc\', -\'\\\'\' + \'\\\'\', -\'\"\' -\'\\\"\' -\'\\\\\"\' + \'\"\', + \'\\\"\', + \'\\\\\"\', -\"\'\" -\"\\\'\" -\"\\\\\'\" + \"\'\", + \"\\\'\", + \"\\\\\'\", -\"\'\\\"\" -\'\\\'\"\' + \"\'\\\"\", + \'\\\'\"\', -\'\\\\\' -\"\\\\\" + \'\\\\\', + \"\\\\\", -\'\\0\' -\'🐶\' + \'\\0\', + \'🐶\', +]; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -\"abc\"; -\"abc\"; - -\"\'\"; - -\'\"\'; -\'\"\'; -\'\\\\\"\'; - -\"\'\"; -\"\'\"; -\"\\\\\'\"; - -\"\'\\\"\"; -\"\'\\\"\"; - -\"\\\\\"; -\"\\\\\"; - -\"\\u0000\"; -\"🐶\"; +[ + \"abc\", + \"abc\", + \"\'\", + \'\"\', + \'\"\', + \'\\\\\"\', + \"\'\", + \"\'\", + \"\\\\\'\", + \"\'\\\"\", + \"\'\\\"\", + \"\\\\\", + \"\\\\\", + \"\\u0000\", + \"🐶\" +]; " `; diff --git a/tests/strings/strings.js b/tests/strings/strings.js index b296b144d..9fb347f76 100644 --- a/tests/strings/strings.js +++ b/tests/strings/strings.js @@ -1,21 +1,23 @@ -"abc" -'abc' +[ + "abc", + 'abc', -'\'' + '\'', -'"' -'\"' -'\\"' + '"', + '\"', + '\\"', -"'" -"\'" -"\\'" + "'", + "\'", + "\\'", -"'\"" -'\'"' + "'\"", + '\'"', -'\\' -"\\" + '\\', + "\\", -'\0' -'🐶' + '\0', + '🐶', +];