-
Notifications
You must be signed in to change notification settings - Fork 77
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
introduce InMemorySuite.LocalSuite and use it to test a `def testProg…
…ram[F[_]: MonadCancelThrow](implicit L: Local[F, Span[F]]): F[Unit]`
- Loading branch information
Showing
5 changed files
with
150 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
modules/core-tests/shared/src/test/scala/LocalTraceSpec.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
// Copyright (c) 2019-2020 by Rob Norris and Contributors | ||
// This software is licensed under the MIT License (MIT). | ||
// For more information see LICENSE or https://opensource.org/licenses/MIT | ||
|
||
package natchez | ||
package mtl | ||
|
||
import cats.effect.{MonadCancelThrow, Trace => _} | ||
import cats.mtl._ | ||
import natchez.InMemory.Lineage.defaultRootName | ||
|
||
class LocalTraceSpec extends InMemorySuite.LocalSuite { | ||
|
||
private def useTrace[F[_]: Trace]: F[Unit] = Trace[F].log("hello world") | ||
|
||
localTest( | ||
"should compile with", | ||
new LocalTest { | ||
override def program[F[_]: MonadCancelThrow](implicit L: Local[F, Span[F]]): F[Unit] = | ||
useTrace[F] | ||
|
||
override def expectedHistory: List[(Lineage, NatchezCommand)] = List( | ||
Lineage.Root -> NatchezCommand | ||
.CreateRootSpan(defaultRootName, Kernel(Map()), Span.Options.Defaults), | ||
Lineage.Root(defaultRootName) -> NatchezCommand.LogEvent("hello world"), | ||
Lineage.Root -> NatchezCommand.ReleaseRootSpan(defaultRootName) | ||
) | ||
} | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters