tasks_tests.rake 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. require 'constants'
  2. namespace TEST_SYM do
  3. desc "Run all unit tests."
  4. task :all => [:directories] do
  5. @ceedling[:test_invoker].setup_and_invoke(COLLECTION_ALL_TESTS)
  6. end
  7. desc "Run single test ([*] real test or source file name, no path)."
  8. task :* do
  9. message = "\nOops! '#{TEST_ROOT_NAME}:*' isn't a real task. " +
  10. "Use a real test or source file name (no path) in place of the wildcard.\n" +
  11. "Example: rake #{TEST_ROOT_NAME}:foo.c\n\n"
  12. @ceedling[:streaminator].stdout_puts( message )
  13. end
  14. desc "Run tests for changed files."
  15. task :delta => [:directories] do
  16. @ceedling[:test_invoker].setup_and_invoke(COLLECTION_ALL_TESTS, TEST_SYM, {:force_run => false})
  17. end
  18. desc "Run tests by matching regular expression pattern."
  19. task :pattern, [:regex] => [:directories] do |t, args|
  20. matches = []
  21. COLLECTION_ALL_TESTS.each { |test| matches << test if (test =~ /#{args.regex}/) }
  22. if (matches.size > 0)
  23. @ceedling[:test_invoker].setup_and_invoke(matches, TEST_SYM, {:force_run => false})
  24. else
  25. @ceedling[:streaminator].stdout_puts("\nFound no tests matching pattern /#{args.regex}/.")
  26. end
  27. end
  28. desc "Run tests whose test path contains [dir] or [dir] substring."
  29. task :path, [:dir] => [:directories] do |t, args|
  30. matches = []
  31. COLLECTION_ALL_TESTS.each { |test| matches << test if File.dirname(test).include?(args.dir.gsub(/\\/, '/')) }
  32. if (matches.size > 0)
  33. @ceedling[:test_invoker].setup_and_invoke(matches, TEST_SYM, {:force_run => false})
  34. else
  35. @ceedling[:streaminator].stdout_puts("\nFound no tests including the given path or path component.")
  36. end
  37. end
  38. end