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

Unnamed tests sometimes do not run #334

Open
bwbecker opened this issue May 15, 2024 · 0 comments
Open

Unnamed tests sometimes do not run #334

bwbecker opened this issue May 15, 2024 · 0 comments

Comments

@bwbecker
Copy link

The following tests yield my expected results:

    test("utest bug v1") {
      test("0") {
        1 ==> 1
        "one"
      }
      test("1") {
        2 ==> 2
        "two"
      }
    }

that is,

+ oat.degreeAudit.parser.CourseSpecParserTests.utest bug v1.0 0ms  one
+ oat.degreeAudit.parser.CourseSpecParserTests.utest bug v1.1 0ms  two

However, if I make them unnamed, I think the intent is for the output to be identical. Even if not, they should at least run but don't appear to:

    test("utest bug v2") {
      test {      // name removed
        1 ==> 1
        "one"
      }
      test {      // name removed
        2 ==> 2
        "two"
      }
    }

yields

+ oat.degreeAudit.parser.CourseSpecParserTests.utest bug v2 0ms  Apply(two)

The documentation for this feature is now considerably less clear than I remember from when I started using uTest (the connection between "utest.* symbol" and the actual code isn't clear to me), but I think the intent is still that names can be omitted from tests.

Finally, I note that if I remove the returned value it works as expected. That is,

    test("utest bug v3") {
      test {      // name removed
        1 ==> 1
        //"one"
      }
      test {      // name removed
        2 ==> 2
       // "two"
      }
    }

yields

+ oat.degreeAudit.parser.CourseSpecParserTests.utest bug v3.0 0ms  
+ oat.degreeAudit.parser.CourseSpecParserTests.utest bug v3.1 0ms  

I do see the "Apply" in the output for v2 and that the documentation has the body of the test be a function. So I wrote:

    def check(i: Int): String = {
      i ==> i
      i.toString
    }
    test("utest bug v4") {
      test { check(1) }
      test { check(2) }
    }

I think this is equivalent to the documentation. However, it too, does not appear to run all of the nested tests:

+ oat.degreeAudit.parser.CourseSpecParserTests.utest bug v4 0ms  Apply(2)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant