Skip to content

Disallow duplicate names within the same context #20

@npryce

Description

@npryce

Either tests with the same name, subcontexts with the same name, or a test with the same name as a subcontext.

    @org.junit.jupiter.api.Test
    fun `names are unique within a context`() {
        assertFailsWith<IllegalArgumentException>("tests") {
            rootContext<Unit> {
                test("nameclash") {}
                test("nameclash") {}
            }.buildNode()
        }
        assertFailsWith<IllegalArgumentException>("contexts") {
            rootContext<Unit> {
                context("nameclash") {}
                context("nameclash") {}
            }.buildNode()
        }
        assertFailsWith<IllegalArgumentException>("context and test") {
            rootContext<Unit> {
                context("nameclash") {}
                test("nameclash") {}
            }.buildNode()
        }
    }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions