Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nushell: restore original test #47254

Merged
merged 1 commit into from
Nov 27, 2019
Merged

nushell: restore original test #47254

merged 1 commit into from
Nov 27, 2019

Conversation

waldyrious
Copy link
Contributor

@waldyrious waldyrious commented Nov 27, 2019

As discussed in #46505, the test for this formula had to be changed due to the behavior of Ctrl+D being mapped to Ctrl+C. The behavior of Ctrl+D has been restored in Nushell v0.6.0, so the test can now be restored.

  • Have you followed the guidelines for contributing?
  • Have you checked that there aren't other open pull requests for the same formula update/change?
  • Have you built your formula locally with brew install --build-from-source <formula>, where <formula> is the name of the formula you're submitting?
  • Is your test running fine brew test <formula>, where <formula> is the name of the formula you're submitting?
  • Does your build pass brew audit --strict <formula> (after doing brew install <formula>)?

@waldyrious
Copy link
Contributor Author

The test is still failing but I can't understand what the issue is. Any insight, @samford, @chenrui333?

Here's the output that I get:

❯ brew test nushell
Testing nushell
==> /usr/local/Cellar/nushell/0.6.0/bin/nu
Error: nushell: failed
An exception occurred within a child process:
  Test::Unit::AssertionFailedError: <"/private/tmp/nushell-test-20191127-74955-h9wnlq> 2\n" +
"/private/tmp/nushell-test-20191127-74955-h9wnlq> CTRL-D\n"> expected but was
<"/private/tmp/nushell-test-20191127-74955-h9wnlq> 2\n" +
"/private/tmp/nushell-test-20191127-74955-h9wnlq> ">.

diff:
  /private/tmp/nushell-test-20191127-74955-h9wnlq> 2
- /private/tmp/nushell-test-20191127-74955-h9wnlq> CTRL-D
?                                                 ^^^^^^^
+ /private/tmp/nushell-test-20191127-74955-h9wnlq>
?                                                 ^
/usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.6.3/lib/ruby/gems/2.6.0/gems/test-unit-3.2.9/lib/test/unit/assertions.rb:55:in `block in assert_block'
/usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.6.3/lib/ruby/gems/2.6.0/gems/test-unit-3.2.9/lib/test/unit/assertions.rb:1636:in `_wrap_assertion'
/usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.6.3/lib/ruby/gems/2.6.0/gems/test-unit-3.2.9/lib/test/unit/assertions.rb:53:in `assert_block'
/usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.6.3/lib/ruby/gems/2.6.0/gems/test-unit-3.2.9/lib/test/unit/assertions.rb:240:in `assert_equal'
/usr/local/Homebrew/Library/Taps/homebrew/homebrew-core/Formula/nushell.rb:23:in `block in <class:Nushell>'
/usr/local/Homebrew/Library/Homebrew/formula.rb:1740:in `block (3 levels) in run_test'
/usr/local/Homebrew/Library/Homebrew/utils.rb:478:in `with_env'
/usr/local/Homebrew/Library/Homebrew/formula.rb:1739:in `block (2 levels) in run_test'
/usr/local/Homebrew/Library/Homebrew/formula.rb:865:in `with_logging'
/usr/local/Homebrew/Library/Homebrew/formula.rb:1738:in `block in run_test'
/usr/local/Homebrew/Library/Homebrew/formula.rb:1977:in `block in mktemp'
/usr/local/Homebrew/Library/Homebrew/mktemp.rb:57:in `block in run'
/usr/local/Homebrew/Library/Homebrew/mktemp.rb:57:in `chdir'
/usr/local/Homebrew/Library/Homebrew/mktemp.rb:57:in `run'
/usr/local/Homebrew/Library/Homebrew/formula.rb:1976:in `mktemp'
/usr/local/Homebrew/Library/Homebrew/formula.rb:1732:in `run_test'
/usr/local/Homebrew/Library/Homebrew/test.rb:30:in `block in <main>'
/usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.6.3/lib/ruby/2.6.0/timeout.rb:93:in `block in timeout'
/usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.6.3/lib/ruby/2.6.0/timeout.rb:33:in `block in catch'
/usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.6.3/lib/ruby/2.6.0/timeout.rb:33:in `catch'
/usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.6.3/lib/ruby/2.6.0/timeout.rb:33:in `catch'
/usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.6.3/lib/ruby/2.6.0/timeout.rb:108:in `timeout'
/usr/local/Homebrew/Library/Homebrew/test.rb:29:in `<main>'

@Bo98
Copy link
Member

Bo98 commented Nov 27, 2019

As mentioned in #46505 (comment), I think it's just a case that "CTRL-D" doesn't get printed out anymore, though the functionality still works. So it's just a case of removing the "CTRL-D" text from the output assertion as described in the comment.

# Remove the test below and return to the better one above if/when Nushell
# reinstates the expected behavior for Ctrl+D (EOF)
assert_match version.to_s, shell_output("#{bin}/nu --version")
assert_equal "#{Dir.pwd}> 2\n#{Dir.pwd}> CTRL-D\n", pipe_output("#{bin}/nu", 'echo \'{"foo":1, "bar":2}\' | from-json | get bar | echo $it')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove CTRL-D\n from the end of the assertion text here (keeping the space before it).

@samford
Copy link
Member

samford commented Nov 27, 2019

Yes, I tested this locally with 0.6.0 and the previous test simply needs to be updated to remove CTRL-D\n from the end of the assertion text to pass.

@waldyrious
Copy link
Contributor Author

Thanks guys! I made the change locally and indeed the test now pass. I've updated the PR accordingly and will now mark it as ready for review/merge.

@waldyrious waldyrious marked this pull request as ready for review November 27, 2019 14:23
@Bo98 Bo98 merged commit d3e6c4c into Homebrew:master Nov 27, 2019
@waldyrious waldyrious deleted the patch-1 branch November 27, 2019 15:33
@lock lock bot added the outdated PR was locked due to age label Jan 1, 2020
@lock lock bot locked as resolved and limited conversation to collaborators Jan 1, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
outdated PR was locked due to age
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants