unit_tests.sh 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. #!/bin/sh
  2. ENABLE=$1
  3. echo ""
  4. echo " DataTables unit tests"
  5. echo ""
  6. if [ ! "$ENABLE" = "Enable" -a ! "$ENABLE" = "Disable" -o "ENABLE" = "-h" ]; then
  7. echo " Enable or Disable must be given as the first argument."
  8. echo " Optionally the second argument can be given as an integer to enable/disable a certain "
  9. echo " set of tests or the string 'sanity' to run the sanity check for all data types."
  10. echo ""
  11. exit 1
  12. fi
  13. cd ../media/unit_testing
  14. if [ "$ENABLE" = "Enable" ]; then
  15. if [ ! -d tests ]; then
  16. echo " Building test directory"
  17. mkdir tests
  18. mkdir tests/1_dom
  19. mkdir tests/2_js
  20. mkdir tests/3_ajax
  21. mkdir tests/4_server-side
  22. mkdir tests/5_ajax_objects
  23. mkdir tests/6_delayed_rendering
  24. fi
  25. echo " Enabling:"
  26. if [ ! -z $2 ]; then
  27. if [ "$2" = "sanity" ]; then
  28. echo " Sanity checks"
  29. mv tests_onhold/1_dom/_zero_config.js tests/1_dom/
  30. mv tests_onhold/2_js/_zero_config.js tests/2_js/
  31. mv tests_onhold/3_ajax/_zero_config.js tests/3_ajax/
  32. mv tests_onhold/4_server-side/_zero_config.js tests/4_server-side/
  33. mv tests_onhold/5_ajax_objects/_zero_config.js tests/5_ajax_objects/
  34. mv tests_onhold/6_delayed_rendering/_zero_config.js tests/6_delayed_rendering/
  35. elif [ $2 -eq 1 ]; then
  36. echo " DOM"
  37. mv tests_onhold/1_dom/* tests/1_dom/
  38. elif [ $2 -eq 2 ]; then
  39. echo " JS"
  40. mv tests_onhold/2_js/* tests/2_js/
  41. elif [ $2 -eq 3 ]; then
  42. echo " Ajax"
  43. mv tests_onhold/3_ajax/* tests/3_ajax/
  44. elif [ $2 -eq 4 ]; then
  45. echo " SErver-side"
  46. mv tests_onhold/4_server-side/* tests/4_server-side/
  47. elif [ $2 -eq 5 ]; then
  48. echo " Ajax objects"
  49. mv tests_onhold/5_ajax_objects/* tests/5_ajax_objects/
  50. elif [ $2 -eq 6 ]; then
  51. echo " Delayed rendering"
  52. mv tests_onhold/6_delayed_rendering/* tests/6_delayed_rendering/
  53. fi
  54. else
  55. echo " All tests"
  56. mv tests_onhold/1_dom/* tests/1_dom/
  57. mv tests_onhold/2_js/* tests/2_js/
  58. mv tests_onhold/3_ajax/* tests/3_ajax/
  59. mv tests_onhold/4_server-side/* tests/4_server-side/
  60. mv tests_onhold/5_ajax_objects/* tests/5_ajax_objects/
  61. mv tests_onhold/6_delayed_rendering/* tests/6_delayed_rendering/
  62. fi
  63. else
  64. echo " Disabling:"
  65. if [ ! -z $2 ]; then
  66. if [ "$2" = "sanity" ]; then
  67. echo " Sanity checks"
  68. mv tests/1_dom/* tests_onhold/1_dom/
  69. mv tests/2_js/* tests_onhold/2_js/
  70. mv tests/3_ajax/* tests_onhold/3_ajax/
  71. mv tests/4_server-side/* tests_onhold/4_server-side/
  72. mv tests/5_ajax_objects/* tests_onhold/5_ajax_objects/
  73. mv tests/6_delayed_rendering/* tests_onhold/6_delayed_rendering/
  74. elif [ $2 -eq 1 ]; then
  75. echo " DOM"
  76. mv tests/1_dom/* tests_onhold/1_dom/
  77. elif [ $2 -eq 2 ]; then
  78. echo " JS"
  79. mv tests/2_js/* tests_onhold/2_js/
  80. elif [ $2 -eq 3 ]; then
  81. echo " Ajax"
  82. mv tests/3_ajax/* tests_onhold/3_ajax/
  83. elif [ $2 -eq 4 ]; then
  84. echo " Server-side"
  85. mv tests/4_server-side/* tests_onhold/4_server-side/
  86. elif [ $2 -eq 5 ]; then
  87. echo " Ajax objects"
  88. mv tests/5_ajax_objects/* tests_onhold/5_ajax_objects/
  89. elif [ $2 -eq 6 ]; then
  90. echo " Delayed rendering"
  91. mv tests/6_delayed_rendering/* tests_onhold/6_delayed_rendering/
  92. fi
  93. else
  94. echo " All tests"
  95. mv tests/1_dom/* tests_onhold/1_dom/
  96. mv tests/2_js/* tests_onhold/2_js/
  97. mv tests/3_ajax/* tests_onhold/3_ajax/
  98. mv tests/4_server-side/* tests_onhold/4_server-side/
  99. mv tests/5_ajax_objects/* tests_onhold/5_ajax_objects/
  100. mv tests/6_delayed_rendering/* tests_onhold/6_delayed_rendering/
  101. fi
  102. fi