From: merch-redmine@... Date: 2019-10-03T21:31:38+00:00 Subject: [ruby-core:95207] [Ruby master Misc#16235] ENV.assoc spec test does not test invalid name Issue #16235 has been updated by jeremyevans0 (Jeremy Evans). It appears if `reserve_names` is called with a name that is already an environment variable, `release_names` will remove that name from the environment, which seems like a bug. Now, that issue exists in the current code (environment variable `foo` is always modified and removed. But if we are going to handle this, we should probably not set @reserved until after checking the names, and only remove the @reserved entries if the instance variable is defined. Note that since these changes are only to the specs, you may want to consider submitting them as pull requests to ruby/spec: https://github.com/ruby/spec/pulls ---------------------------------------- Misc #16235: ENV.assoc spec test does not test invalid name https://bugs.ruby-lang.org/issues/16235#change-81881 * Author: burdettelamar@yahoo.com (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: