OpEq.js 746 B

123456789101112131415161718192021222324252627282930313233343536
  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. var G = 0;
  6. var x = new Array();
  7. var obj = new Object();
  8. var i = 0;
  9. obj.y = 0;
  10. x[i] = i;
  11. function foo()
  12. {
  13. G++;
  14. return x;
  15. }
  16. function bar()
  17. {
  18. G++;
  19. return obj;
  20. }
  21. foo()[i++]++;
  22. bar().y += G;
  23. if (x[0] != 1 || x.length != 1 || G != 2 || i != 1 || obj.y != 2)
  24. {
  25. WScript.Echo("FAILED");
  26. }
  27. else
  28. {
  29. WScript.Echo("Passed");
  30. }