Skip to content

testing: panicing test is reported as PASSing #5149

Description

@gopherbot

by coocood:

What steps will reproduce the problem?
If possible, include a link to a program on play.golang.org.
1. write a test method as following:
   func TestPanic(t *testing.T){
    panic("a")
    t.Fail()
   }
2. run "go test -v"

What is the expected output?

report "--- Fail:"

What do you see instead?

report "--- PASS:"

Which compiler are you using (5g, 6g, 8g, gccgo)?

6g

Which operating system are you using?

windows 7 sp1


Which version are you using?  (run 'go version')

devel +ff83e39f1348

Activity

  1. gopherbot commented on Mar 28, 2013

    @gopherbot
    ContributorAuthor

    Comment 1 by coocood:

    What steps will reproduce the problem?
    If possible, include a link to a program on play.golang.org.
    1. write a test method as following:
       func TestPanic(t *testing.T){
        panic("a")
        t.Fail()
       }
    2. run "go test -v"
    What is the expected output?
    report "--- Fail:"
    What do you see instead?
    report "--- PASS:"
    Which compiler are you using (5g, 6g, 8g, gccgo)?
    6g
    Which operating system are you using?
    windows 7 sp1
    Which version are you using?  (run 'go version')
    devel +ff83e39f1348
  2. davecheney commented on Mar 29, 2013

    @davecheney
    Contributor

    Comment 2:

    A test that executes a raw panic will be marked as passing, although the entire test
    suite is correctly marked as failing.
    lucky(~/src/panic) % go test -v
    === RUN TestPanic
    --- PASS: TestPanic (0.00 seconds)
    panic: a [recovered]
            panic: a
    goroutine 3 [running]:
    testing.func·004()
            /home/dfc/go/src/pkg/testing/testing.go:341 +0xbc
    panic.TestPanic(0xc200075000)
            /home/dfc/src/panic/t_test.go:6 +0x53
    testing.tRunner(0xc200075000, 0x5b0a20)
            /home/dfc/go/src/pkg/testing/testing.go:346 +0x8a
    created by testing.RunTests
            /home/dfc/go/src/pkg/testing/testing.go:426 +0x86b
    goroutine 1 [chan receive]:
    testing.RunTests(0x53a310, 0x5b0a20, 0x1, 0x1, 0x1, ...)
            /home/dfc/go/src/pkg/testing/testing.go:427 +0x88e
    testing.Main(0x53a310, 0x5b0a20, 0x1, 0x1, 0x5b8420, ...)
            /home/dfc/go/src/pkg/testing/testing.go:358 +0x8a
    main.main()
            panic/_test/_testmain.go:43 +0x9a
    exit status 2
    FAIL    panic   0.015s

    Labels changed: added priority-soon, go1.1maybe, removed priority-triage.

    Status changed to Accepted.

  3. gopherbot commented on Mar 30, 2013

    @gopherbot
    ContributorAuthor

    Comment 3 by coocood:

    My CL for this issue:
    https://golang.org/cl/8136043/
  4. davecheney commented on Apr 1, 2013

    @davecheney
    Contributor

    Comment 4:

    This issue was closed by revision 174a17e.

    Status changed to Fixed.

  5. added this to the Go1.1 milestone on Apr 14, 2015
  6. locked and limited conversation to collaborators on Jun 24, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions