(maint) Add tests for tar.rb and fix a bug