[ruby-core:95208] [Ruby master Misc#16235] ENV.assoc spec test does not test invalid name
From:
burdettelamar@...
Date:
2019-10-03 21:54:05 UTC
List:
ruby-core #95208
Issue #16235 has been updated by [email protected] (Burdette Lamar). Method :reserve_names fails if any name is already in use: ``` def reserve_names(*names) @reserved = names @reserved.each do |name| fail "Name #{name} is already in use" if ENV.include?(name) end end ``` So, not a problem? ---------------------------------------- Misc #16235: ENV.assoc spec test does not test invalid name https://bugs.ruby-lang.org/issues/16235#change-81882 * Author: [email protected] (Burdette Lamar) * Status: Open * Priority: Normal * Assignee: ---------------------------------------- The most important thing here is an added test for an invalid name argument to ENV.assoc, which should raise TypeError. I've also added to spec_helper.rb: - Methods :reserve_names and :release_names, to reserve and release names used in the test. - Method :mock_to_str, to return a mock object that responds to :to_str. The updated assoc_spec.rb uses all of these, as will many other spec tests for ENV, as I get to them. It's known that some of the ENV spec tests do not test a method's return value, and that some do not test error conditions (as above), so more to come. All in good time. ---Files-------------------------------- t.diff (2.24 KB) -- https://bugs.ruby-lang.org/ Unsubscribe: <mailto:[email protected]?subject=unsubscribe> <http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>