PageRenderTime 58ms CodeModel.GetById 31ms RepoModel.GetById 0ms app.codeStats 0ms

/test/acceptance/ecma3/GlobalObject/encodeURIComponent.as

https://github.com/changm/tessa
ActionScript | 97 lines | 36 code | 25 blank | 36 comment | 0 complexity | 64306c02eddcf97f904670e4f893fc42 MD5 | raw file
  1. /* ***** BEGIN LICENSE BLOCK *****
  2. * Version: MPL 1.1/GPL 2.0/LGPL 2.1
  3. *
  4. * The contents of this file are subject to the Mozilla Public License Version
  5. * 1.1 (the "License"); you may not use this file except in compliance with
  6. * the License. You may obtain a copy of the License at
  7. * http://www.mozilla.org/MPL/
  8. *
  9. * Software distributed under the License is distributed on an "AS IS" basis,
  10. * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
  11. * for the specific language governing rights and limitations under the
  12. * License.
  13. *
  14. * The Original Code is [Open Source Virtual Machine.].
  15. *
  16. * The Initial Developer of the Original Code is
  17. * Adobe System Incorporated.
  18. * Portions created by the Initial Developer are Copyright (C) 2005-2006
  19. * the Initial Developer. All Rights Reserved.
  20. *
  21. * Contributor(s):
  22. * Adobe AS3 Team
  23. *
  24. * Alternatively, the contents of this file may be used under the terms of
  25. * either the GNU General Public License Version 2 or later (the "GPL"), or
  26. * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
  27. * in which case the provisions of the GPL or the LGPL are applicable instead
  28. * of those above. If you wish to allow use of your version of this file only
  29. * under the terms of either the GPL or the LGPL, and not to allow others to
  30. * use your version of this file under the terms of the MPL, indicate your
  31. * decision by deleting the provisions above and replace them with the notice
  32. * and other provisions required by the GPL or the LGPL. If you do not delete
  33. * the provisions above, a recipient may use your version of this file under
  34. * the terms of any one of the MPL, the GPL or the LGPL.
  35. *
  36. * ***** END LICENSE BLOCK ***** */
  37. var SECTION = "15.1.3.4";
  38. var VERSION = "ECMA_1";
  39. startTest();
  40. var TITLE = "encodeURIComponent";
  41. writeHeaderToLog( SECTION + " "+ TITLE);
  42. var testcases = getTestCases();
  43. test();
  44. function getTestCases() {
  45. var array = new Array();
  46. var item = 0;
  47. str1 = new String("h");
  48. array[item++] = new TestCase( SECTION, "encodeURIComponent('')", "", encodeURIComponent("") );
  49. array[item++] = new TestCase( SECTION, "encodeURIComponent(str1)", "h", encodeURIComponent(str1) );
  50. array[item++] = new TestCase( SECTION, "encodeURIComponent('Hello{[World]}')", "Hello%7B%5BWorld%5D%7D", encodeURIComponent("Hello{[World]}") );
  51. array[item++] = new TestCase( SECTION, "encodeURIComponent('Macromedia - Flash')", "Macromedia%20-%20Flash", encodeURIComponent("Macromedia - Flash") );
  52. array[item++] = new TestCase( SECTION, "encodeURIComponent('2 * 4 + [8 + 5 ] - 3')", "2%20*%204%20%2B%20%5B8%20%2B%205%20%5D%20-%203", encodeURIComponent("2 * 4 + [8 + 5 ] - 3") );
  53. array[item++] = new TestCase( SECTION, "encodeURIComponent('Flash(Macromedia)')", "Flash(Macromedia)", encodeURIComponent("Flash(Macromedia)") );
  54. array[item++] = new TestCase( SECTION, "encodeURIComponent('BugID #17485')", "BugID%20%2317485", encodeURIComponent("BugID #17485") );
  55. array[item++] = new TestCase( SECTION, "encodeURIComponent('http://www.macromedia.com/flasha player')", "http%3A%2F%2Fwww.macromedia.com%2Fflasha%20player", encodeURIComponent("http://www.macromedia.com/flasha player") );
  56. array[item++] = new TestCase( SECTION, "encodeURIComponent('http://www.macromedia.com/flashA player')", "http%3A%2F%2Fwww.macromedia.com%2FflashA%20player", encodeURIComponent("http://www.macromedia.com/flashA player") );
  57. array[item++] = new TestCase( SECTION, "encodeURIComponent('http://www.macromedia.com/flash_ player')", "http%3A%2F%2Fwww.macromedia.com%2Fflash_%20player", encodeURIComponent("http://www.macromedia.com/flash_ player") );
  58. array[item++] = new TestCase( SECTION, "encodeURIComponent('http://www.macromedia.com/flash- player')", "http%3A%2F%2Fwww.macromedia.com%2Fflash-%20player", encodeURIComponent("http://www.macromedia.com/flash- player") );
  59. array[item++] = new TestCase( SECTION, "encodeURIComponent('http://www.macromedia.com/flash. player')", "http%3A%2F%2Fwww.macromedia.com%2Fflash.%20player", encodeURIComponent("http://www.macromedia.com/flash. player") );
  60. array[item++] = new TestCase( SECTION, "encodeURIComponent('http://www.macromedia.com/flash! player')", "http%3A%2F%2Fwww.macromedia.com%2Fflash!%20player", encodeURIComponent("http://www.macromedia.com/flash! player") );
  61. array[item++] = new TestCase( SECTION, "encodeURIComponent('http://www.macromedia.com/flash~ player')", "http%3A%2F%2Fwww.macromedia.com%2Fflash~%20player", encodeURIComponent("http://www.macromedia.com/flash~ player") );
  62. array[item++] = new TestCase( SECTION, "encodeURIComponent('http://www.macromedia.com/flash* player')", "http%3A%2F%2Fwww.macromedia.com%2Fflash*%20player", encodeURIComponent("http://www.macromedia.com/flash* player") );
  63. array[item++] = new TestCase( SECTION, "encodeURIComponent('http://www.macromedia.com/'flash player'')", "http%3A%2F%2Fwww.macromedia.com%2F'flash%20player'", encodeURIComponent("http://www.macromedia.com/'flash player'") );
  64. array[item++] = new TestCase( SECTION, "encodeURIComponent('http://www.macromedia.com/(flash player)')", "http%3A%2F%2Fwww.macromedia.com%2F(flash%20player)", encodeURIComponent("http://www.macromedia.com/(flash player)") );
  65. array[item++] = new TestCase( SECTION, "encodeURIComponent('http%3A%2F%2Fwww.macromedia.com/flash; player')", "http%3A%2F%2Fwww.macromedia.com%2Fflash%3B%20player", encodeURIComponent("http://www.macromedia.com/flash; player")+"" );
  66. array[item++] = new TestCase( SECTION, "encodeURIComponent('http://www.macromedia.com/flash player?')", "http%3A%2F%2Fwww.macromedia.com%2Fflash%20player%3F", encodeURIComponent("http://www.macromedia.com/flash player?")+"" );
  67. array[item++] = new TestCase( SECTION, "encodeURIComponent('http://www.macromedia.com/flash player@')", "http%3A%2F%2Fwww.macromedia.com%2Fflash%20player%40", encodeURIComponent("http://www.macromedia.com/flash player@")+"" );
  68. array[item++] = new TestCase( SECTION, "encodeURIComponent('http://www.macromedia.com/flash player&')", "http%3A%2F%2Fwww.macromedia.com%2Fflash%20player%26", encodeURIComponent("http://www.macromedia.com/flash player&")+"" );
  69. array[item++] = new TestCase( SECTION, "encodeURIComponent('http://www.macromedia.com/flash player=')", "http%3A%2F%2Fwww.macromedia.com%2Fflash%20player%3D", encodeURIComponent("http://www.macromedia.com/flash player=")+"" );
  70. array[item++] = new TestCase( SECTION, "encodeURIComponent('http://www.macromedia.com/flash player$')", "http%3A%2F%2Fwww.macromedia.com%2Fflash%20player%24", encodeURIComponent("http://www.macromedia.com/flash player$")+"" );
  71. return ( array );
  72. }