Skip to content

[suite] Should testify.Suite run all tests from the sub suite in the case when passed -testify.m flag? #1050

@denis-tingaikin

Description

@denis-tingaikin

Hello guys,

We've found one funny thing about suite.Run. It allows running inner suites (that look awesome to me :) ). But this working some strange if passed testify.m parameter.

For example:

package mypkg_test

import "github.com/stretchr/testify/suite"

type suite1 struct{
    suite.Suite
}

func (s *suite1) Test1() {
    println("test1")
}

type suite2 struct{
    suite.Suite
}

func (s *suite2) Test2() {
    suite.Run(s.T(), new(suite1))
}

func TestSuite2(t *testing.T) {
    suite.Run(t, new(suite2))
}

So if I just run TestSuite2 then it works fine (suite2 runs all tests from suite1).
But if I run TestSuite2 with paramter -testify.m="Test2" then suite1 will be ignored.

Please share your thoughts about:

  1. Is sub suites legal?
  2. Should the matching filter ignore sub suites?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions