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

Remove a duplicated test #378

Merged
merged 1 commit into from Oct 16, 2017

Conversation

@pocke
Copy link
Collaborator

commented Oct 16, 2017

test_do_cond and test_identifier_eh is redefined.

With RUBYOPT=-w, rake command displays the following warnings.

/home/pocke/ghq/github.com/whitequark/parser/test/test_lexer.rb:591: warning: method redefined; discarding old test_do_cond
/home/pocke/ghq/github.com/whitequark/parser/test/test_lexer.rb:572: warning: previous definition of test_do_cond was here
/home/pocke/ghq/github.com/whitequark/parser/test/test_lexer.rb:981: warning: method redefined; discarding old test_identifier_eh
/home/pocke/ghq/github.com/whitequark/parser/test/test_lexer.rb:964: warning: previous definition of test_identifier_eh was here

This change only suppresses one of the warnings that is for test_do_cond.

test_do_cond is defined twice with same meaning code.
So, we can remove one of these safely.

But this change does not suppres the warning that is for test_identifier_eh.
Because the overridden test does not pass.

def test_identifier_eh # This test case is overrided!
  assert_scanned("identifier?",
                 :tFID,        "identifier?", [0, 11])

  assert_scanned("identifier?=",
                 :tIDENTIFIER, "identifier", [0, 10],
                 :tNEQ,        "?=",         [10, 12])
end

def test_identifier_eh
  assert_scanned("identifier?", :tFID, "identifier?", [0, 11])
end

If we remove the second test_identifier_eh, the first test_identifier_eh is failed.

$ rake
Run options: --seed 40

................................................................................................................................................................................................................................................................................................................................................................................................................F...........................................................................................................................................................................................................................................................................................................................................................................................................................................................................

Finished in 1.992764s, 431.5613 runs/s, 37392.7777 assertions/s.

  1) Failure:
TestLexer#test_identifier_eh [/home/pocke/ghq/github.com/whitequark/parser/test/test_lexer.rb:958]:
identifier?=.
Expected [:tINTEGER, 61] to be eql? [:tNEQ, "?="].

860 runs, 74515 assertions, 1 failures, 0 errors, 0 skips

The first(overridden) test_identifier_eh is added in d599084.

Remove a duplicated test
`test_do_cond` and `test_identifier_eh` is redefined.

With `RUBYOPT=-w`, `rake` command displays the following warnings.

```
/home/pocke/ghq/github.com/whitequark/parser/test/test_lexer.rb:591: warning: method redefined; discarding old test_do_cond
/home/pocke/ghq/github.com/whitequark/parser/test/test_lexer.rb:572: warning: previous definition of test_do_cond was here
/home/pocke/ghq/github.com/whitequark/parser/test/test_lexer.rb:981: warning: method redefined; discarding old test_identifier_eh
/home/pocke/ghq/github.com/whitequark/parser/test/test_lexer.rb:964: warning: previous definition of test_identifier_eh was here
```

This change suppresses the one of the warnings that is for `test_do_cond`.

`test_do_cond` is defined twice with same meaning code.
So, we can remove one of these safely.

And this change does not suppres the warning that is for `test_identifier_eh`.
Because the overridden test does not pass.

```ruby
def test_identifier_eh # This test case is overrided!
  assert_scanned("identifier?",
                 :tFID,        "identifier?", [0, 11])

  assert_scanned("identifier?=",
                 :tIDENTIFIER, "identifier", [0, 10],
                 :tNEQ,        "?=",         [10, 12])
end

def test_identifier_eh
  assert_scanned("identifier?", :tFID, "identifier?", [0, 11])
end
```

If we remove the second `test_identifier_eh`, the first `test_identifier_eh` is failed.

```bash
$ rake
Run options: --seed 40

................................................................................................................................................................................................................................................................................................................................................................................................................F...........................................................................................................................................................................................................................................................................................................................................................................................................................................................................

Finished in 1.992764s, 431.5613 runs/s, 37392.7777 assertions/s.

  1) Failure:
TestLexer#test_identifier_eh [/home/pocke/ghq/github.com/whitequark/parser/test/test_lexer.rb:958]:
identifier?=.
Expected [:tINTEGER, 61] to be eql? [:tNEQ, "?="].

860 runs, 74515 assertions, 1 failures, 0 errors, 0 skips
```

The first(overridden) `test_identifier_eh` is added in d599084.

@whitequark whitequark merged commit 9532490 into whitequark:master Oct 16, 2017

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
@whitequark

This comment has been minimized.

Copy link
Owner

commented Oct 16, 2017

Thank you! Because you consistently send excellent pull requests, I have added you as a collaborator. When you are certain of a change, feel free to commit it directly.

@whitequark

This comment has been minimized.

Copy link
Owner

commented Oct 16, 2017

I've resolved the other duplicate test issue.

@pocke pocke deleted the pocke:remove-duplicated-test branch Oct 16, 2017

@pocke

This comment has been minimized.

Copy link
Collaborator Author

commented Oct 16, 2017

Thank you for the invitation!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.