blue595539.js 1.1 KB

12345678910111213141516171819202122232425262728
  1. //-------------------------------------------------------------------------------------------------------
  2. // Copyright (C) Microsoft. All rights reserved.
  3. // Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
  4. //-------------------------------------------------------------------------------------------------------
  5. function testES6Whitespace(whitespaceChar, whitespaceCode) {
  6. try {
  7. var str = "var " + whitespaceChar + "a = 5;";
  8. eval(str);
  9. if (a !== 5) {
  10. throw new Error("Eval value didn't equal to 5.");
  11. }
  12. } catch (ex) {
  13. WScript.Echo("Whitespace error with: " + whitespaceCode + "\r\nMessage: " + ex.message);
  14. }
  15. }
  16. var whitespaceChars = [
  17. { code: 0x9, strValue: "0x9" },
  18. { code: 0xB, strValue: "0xB" },
  19. { code: 0xC, strValue: "0xC" },
  20. { code: 0x20, strValue: "0x20" },
  21. { code: 0xA0, strValue: "0xA0" },
  22. { code: 0xFEFF, strValue: "0xFEFF" }];
  23. whitespaceChars.forEach(function (item) { testES6Whitespace(String.fromCharCode(item.code), item.strValue); });
  24. WScript.Echo("Pass");