ChakraLib.js 1.3 KB

1234567891011121314151617181920212223242526
  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. WScript.LoadScriptFile("..\\UnitTestFramework\\UnitTestFramework.js");
  6. var tests = [
  7. {
  8. name: "Access to __chakraLibrary work",
  9. body: function () {
  10. assert.isNotUndefined(__chakraLibrary, "__chakraLibrary must NOT be undefined as we're using the -LdChakraLib flag.");
  11. },
  12. },
  13. {
  14. name: "Overriding __chakraLibrary must not work change the behavior.",
  15. body: function () {
  16. __chakraLibrary = -1;
  17. var array = [1, 2, 3, 4];
  18. assert.areNotEqual(__chakraLibrary, -1, "__chakraLibrary must not be equal to -1 as the -LdChakraLib flag force to use the internal library associated to the __chakraLibrary token.");
  19. assert.areEqual(array.indexOf(4), 3, "The __chakraLibrary in the indexOf method must give access to built ins methods instead of -1.");
  20. }
  21. }
  22. ];
  23. testRunner.runTests(tests, { verbose: WScript.Arguments[0] != "summary" });