cweill / gotests

Automatically generate Go test boilerplate from your source code.
Apache License 2.0
4.95k stars 345 forks source link

Add alias for `t` receiver type name #108

Closed alvinmatias69 closed 5 years ago

alvinmatias69 commented 5 years ago

Create alias tr for receiver with name t to avoid conflict with the test parameters (t *testing.T). Also, add unit test for method with t receiver type name and fixes conflict unit tests accordingly.

func TestTestReceiver_FooMethod(t *testing.T) {
    tests := []struct {
        name    string
-       t       *TestReceiver
+       tr      *TestReceiver
        wantErr bool
    }{
        // TODO: Add test cases.
    }
    for _, tt := range tests {
-       t := &TestReceiver{}
-       if err := t.FooMethod(); (err != nil) != tt.wantErr {
+       tr := &TestReceiver{}
+       if err := tr.FooMethod(); (err != nil) != tt.wantErr {
    ...

fix #100

googlebot commented 5 years ago

Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

:memo: Please visit https://cla.developers.google.com/ to sign.

Once you've signed (or fixed any issues), please reply here with @googlebot I signed it! and we'll verify it.


What to do if you already signed the CLA

Individual signers
Corporate signers

ℹ️ Googlers: Go here for more info.

coveralls commented 5 years ago

Coverage Status

Coverage increased (+0.02%) to 96.399% when pulling d66e2bb6a88d84465e74ef0a4f257634005b5e35 on alvinmatias69:fix_t_receiver into 88d586d842701ac013a269d0b2445b68f64850a0 on cweill:develop.

alvinmatias69 commented 5 years ago

@googlebot I signed it!

googlebot commented 5 years ago

CLAs look good, thanks!

ℹ️ Googlers: Go here for more info.