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

zio 2.1.14, test fixes #922

Merged
merged 1 commit into from
Jan 4, 2025
Merged

zio 2.1.14, test fixes #922

merged 1 commit into from
Jan 4, 2025

Conversation

justcoon
Copy link
Contributor

@justcoon justcoon commented Jan 4, 2025

zio 2.1.14, test fixes (Trace.unapply changed, and there were issues with line 0)

@justcoon justcoon requested a review from a team as a code owner January 4, 2025 14:21
@justcoon justcoon merged commit 2c2d7bb into zio:master Jan 4, 2025
15 checks passed
@@ -29,7 +29,7 @@ object LoggerNameExtractorSpec extends ZIOSpecDefault {
} else trace
}
val result = extractor(
Trace.apply(trace, "", 0),
Trace.apply(trace, "", 1),
Copy link
Member

@guizmaii guizmaii Jan 5, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@justcoon Can I ask why you need to change these 0 into 1? 🤔

I made a bunch of changes in zio.Trace but I'm not sure to understand what would require this change here. Did I introduce an issue? 🤔

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hi @guizmaii , look like there is some issue with latest change

import zio.test._
import zio.Trace

object TraceSpec extends ZIOSpecDefault {

  val spec: Spec[Environment, Any] = suite("TraceSpec")(
    test("line") {
      val expected = 0

      val trace = Trace.apply("", "", expected)

      val line = trace match {
        case Trace(_, _, line) => line
        case _                 => -1
      }

      assertTrue(line == expected)

    }
  )
}

fail with

Assertion failed:
Expected :0
Actual   :-1
<Click to see difference>

  ✗ -1 was not equal to 0
  line == expected
  line = -1

however, I guessed that in reality there will not be Trace with line=0, so I just updated tests

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting. I guess the previous behaviour was kind of incorrect as the Trace.unapply should probably have returned None for an empty String, don't you think? 🤔

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

Successfully merging this pull request may close these issues.

2 participants