ruby-core@ruby-lang.org archive (unofficial mirror)
 help / color / mirror / Atom feed
From: burdettelamar@yahoo.com
To: ruby-core@ruby-lang.org
Subject: [ruby-core:95208] [Ruby master Misc#16235] ENV.assoc spec test does not test invalid name
Date: Thu, 03 Oct 2019 21:54:05 +0000 (UTC)	[thread overview]
Message-ID: <redmine.journal-81882.20191003215405.4a13834871df2b5e@ruby-lang.org> (raw)
In-Reply-To: redmine.issue-16235.20191003210512@ruby-lang.org

Issue #16235 has been updated by burdettelamar@yahoo.com (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: 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/

  parent reply	other threads:[~2019-10-03 21:54 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <redmine.issue-16235.20191003210512@ruby-lang.org>
2019-10-03 21:05 ` [ruby-core:95205] [Ruby master Misc#16235] ENV.assoc spec test does not test invalid name burdettelamar
2019-10-03 21:31 ` [ruby-core:95207] " merch-redmine
2019-10-03 21:54 ` burdettelamar [this message]
2019-10-03 23:07 ` [ruby-core:95210] " merch-redmine
2019-10-04  0:58 ` [ruby-core:95214] " burdettelamar
2019-10-05 19:08 ` [ruby-core:95235] " burdettelamar
2019-10-05 22:53 ` [ruby-core:95238] " burdettelamar

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.ruby-lang.org/en/community/mailing-lists/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=redmine.journal-81882.20191003215405.4a13834871df2b5e@ruby-lang.org \
    --to=ruby-core@ruby-lang.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).