stringAndNonStrings.js 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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. /*
  6. *******************************UNIT TEST FOR SWITCH CASE OPTIMIZATION*******************************
  7. * Test with one switch statement containing strings, objects and integers.
  8. */
  9. function f(x,y)
  10. {
  11. //This switch contains - a strings, a int in the middle
  12. switch(x)
  13. {
  14. case 'abc':
  15. WScript.Echo('abc');
  16. break;
  17. case 'def':
  18. WScript.Echo('def');
  19. break;
  20. case 'ghi':
  21. WScript.Echo('ghi');
  22. break;
  23. case 'jkl':
  24. WScript.Echo('jkl');
  25. break;
  26. case 'mno':
  27. WScript.Echo('mno');
  28. break;
  29. case 2:
  30. WScript.Echo('pqr');
  31. break;
  32. case 'stu':
  33. WScript.Echo('stu');
  34. break;
  35. case 'vxy':
  36. WScript.Echo('vxy');
  37. break;
  38. case f:
  39. WScript.Echo('z');
  40. break;
  41. case 'x':
  42. WScript.Echo('x');
  43. break;
  44. default:
  45. WScript.Echo('default');
  46. break;
  47. }
  48. }
  49. f('stu');
  50. f('stu');
  51. f('vxy');
  52. f('z');
  53. f('x');
  54. f('abc');
  55. f('def');
  56. f('ghi');
  57. f('jkl');
  58. f('mno');
  59. f('pqr');
  60. f('saf');