hello-algo/zh-hant/codes/ruby/test_all.rb
Yudong Jin b2f0d4603d
Many bug fixes and improvements (#1270)
* Add Ruby and Kotlin icons
Add the avatar of @curtishd

* Update README

* Synchronize zh-hant and zh versions.

* Translate the pythontutor blocks to traditional Chinese

* Fix en/mkdocs.yml

* Update the landing page of the en version.

* Fix the Dockerfile

* Refine the en landingpage

* Fix en landing page

* Reset the README.md
2024-04-11 20:18:19 +08:00

23 lines
547 B
Ruby

require 'open3'
start_time = Time.now
ruby_code_dir = File.dirname(__FILE__)
files = Dir.glob("#{ruby_code_dir}/chapter_*/*.rb")
errors = []
files.each do |file|
stdout, stderr, status = Open3.capture3("ruby #{file}")
errors << stderr unless status.success?
end
puts "\x1b[34mTested #{files.count} files\x1b[m"
unless errors.empty?
puts "\x1b[33mFound exception in #{errors.length} files\x1b[m"
raise errors.join("\n\n")
else
puts "\x1b[32mPASS\x1b[m"
end
puts "Testing finishes after #{((Time.now - start_time) * 1000).round} ms"