bug_OS_3080673.js 901 B

1234567891011121314151617181920212223242526272829303132
  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 testStrict() {
  6. "use strict";
  7. try {
  8. var o3 = new String("aaa");
  9. o3[0] = "b";
  10. WScript.Echo("failed");
  11. }
  12. catch (e) {
  13. WScript.Echo("passed");
  14. }
  15. }
  16. testStrict();
  17. function testNonStrict() {
  18. try {
  19. var o3 = new String("aaa");
  20. o3[0] = "b";
  21. if (o3 != "aaa")
  22. WScript.Echo("failed");
  23. else
  24. WScript.Echo("passed");
  25. }
  26. catch (e) {
  27. WScript.Echo("failed");
  28. }
  29. }
  30. testNonStrict();