text stringlengths 14 100k | source stringclasses 1
value | repo stringclasses 810
values | language stringclasses 13
values |
|---|---|---|---|
<|fim_suffix|> Any, Any] = {
val MAX_STEPS = 128
def ch2(st: ChannelState[Env, Any]): ZChannel[Env, Any, Any, Any, Any, Any, Any] =
st match {
case _: ChannelState.Done.type =>
exec.getDone match {
case Exit.Success(res) =>
ZChannel.succeedNow(res)
c... | fim | zio/zio | scala |
<|fim_suffix|>al Utf16LE: Chunk[Byte] = Chunk(-1, -2)
val Utf32BE: Chunk[Byte] = Chunk(0, 0, -2, -1)
val Utf32LE: Chunk[Byte] = Chunk(-1, -2, 0, 0)
}
}
<|fim_prefix|>package zio.stream.internal
import zi<|fim_middle|>o.Chunk
import java.nio.charset.Charset
private[zio] object CharacterSet {
val CharsetU... | fim | zio/zio | scala |
<|fim_prefix|>/*
* Copyright 2020-2024 John A. De Goes and the ZIO Contributors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
*... | fim | zio/zio | scala |
<|fim_suffix|> readFromCurrentChunk(cbuf, off, len)
written + len
} else {
val av = availableInCurrentChunk
readFromCurrentChunk(cbuf, off, av)
loadNext()
if (done) {
written + av
} else {
doRead(cbuf, off + av, len - av, written + av)
}
}
private de... | fim | zio/zio | scala |
<|fim_prefix|>/*
* Copyright 2018-2024 John A. De Goes and the ZIO Contributors
*
* Licensed under the Apache L<|fim_suffix|>* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language gov... | fim | zio/zio | scala |
<|fim_suffix|>, R, E, O](self)
/**
* Automatically assembles a layer for the ZStream effect.
*/
def provide[E1 >: E](layer: ZLayer[_, E1, _]*): ZStream[Any, E1, O] =
macro LayerMacros.provideImpl[ZStream, R, E1, O]
}
final class ProvideSomeLayerStreamPartiallyApplied[R0, -R, +E, +O](
val self: ZStrea... | fim | zio/zio | scala |
package zio.stream
import zio.ZLayer
import zio.internal.macros.LayerMacros
private[stream] trait ZStreamVersionSpecific[-R, +E, +O] { self: ZStream[R, E, O] =>
/**
* Automatically assembles a layer for the ZStream effect, which translates it
* to another level.
*/
inline def provide[E1 >: E](inline lay... | fim | zio/zio | scala |
<|fim_prefix|>package zio.stream
import zio.test.Assertion.{containsCause, equalTo, failsCause, isFalse, isTrue}
import zio.test.{Gen, assert, assertZIO, check}
import zio.{Cause, Chunk, Promise, Ref, Schedule, ZIO, ZIOBaseSpec}
import scala.concurrent.ExecutionContext.Implicits.global
import scala.concurrent.Future
... | fim | zio/zio | scala |
<|fim_prefix|>package zio.stream
import zio._
import zio.stream.compression.TestData._
import zio.test.Assertion._
import zio.test._
import java.util.zip.Deflater
object DeflateSpec extends ZIOBaseSpec {
override def spec =
suite("DeflateSpec")(
test("JDK inflates what was deflated")(
check(Gen.l... | fim | zio/zio | scala |
<|fim_prefix|>package zio.stream
import z<|fim_suffix|>rly if header is corrupted")(
assertZIO(
(ZStream.fromIterable(1 to 10).map(_.toByte).channel >>> Gunzip.makeGunzipper()).runCollect.exit
)(fails(anything))
),
test("fail if input stream finished unexpected")(
assertZI... | fim | zio/zio | scala |
<|fim_prefix|>package zio.stream
import zio._
import zio.stream.compression.TestData._
import zio.test.Assertion._
import zio.test._
object GzipSpec extends ZIOBaseSpec {
override def spec =
suite("GzipSpec")(
test("JDK gunzips what was gzipped")(
check(Gen.listOfBounded(0, size)(Gen.byte).zip(Gen... | fim | zio/zio | scala |
<|fim_prefix|>package zio.stream
import zio._
import zio.stream.compression.TestData._
import zio.test.Assertion._
import zio.test._
import java.util.zip.Deflater
import Inflate._
object InflateSpec extends ZIOBaseSpec {
override def spec =
suite("CompressionSpec")(
test("short stream")(
assertZ... | fim | zio/zio | scala |
<|fim_prefix|>package zio.stream
import zio._
import zio.stream.ZStream.fromChunk
import zio.test.Assertion._
import zio.test._
object RechunkSpec extends ZIOBaseSpec {
override def spec =
suite("RechunkSpec")(
test("rechunk small with rest")(
assertZIO(ZStream(1, 2, 3, 4, 5).rechunk(2).chunks.run... | fim | zio/zio | scala |
<|fim_prefix|>package zio.stream
import zio._
import zio.stream.compression.TestData._
import zio.test._
import zio.test.Assert<|fim_suffix|> .rechunk(n)
.via(ZPipeline.gzip(bufferSize))
.runCollect
inflated <- jdkGunzip(gzipped)
... | fim | zio/zio | scala |
<|fim_suffix|>)
}
<|fim_prefix|>package zio.stream
import zio._
import zio.test.Assertion._
import zio.test._
import java.io.ByteArrayOutputStream
import java.security.MessageDigest
object ZSinkPlatformSpecificSpec extends ZIOBaseSpec {
override def spec: Spec[Any, Throwable] = suite("ZSink JVM")(
suite("dige... | fim | zio/zio | scala |
package zio.stream
import zio._
import zio.test.Assertion._
import zio.test.TestAspect.flaky
import zio.test._
import java.io._
import java.net.InetSocketAddress
import java.nio.channels.AsynchronousSocketChannel
import java.nio.{Buffer, ByteBuffer}
import java.util.concurrent.CountDownLatch
import scala.concurrent.E... | fim | zio/zio | scala |
<|fim_suffix|>me.md".getBytes(StandardCharsets.ISO_8859_1) ++ Array(0.toByte))
val headerWithCrc: ZStream[Any, Nothing, Byte] = {
val crcFlag = 2
val headerBytes = Array(31, 139, 8, crcFlag, 0, 0, 0, 0, 0, 0).map(_.toByte)
val crc32 = new CRC32
crc32.update(headerBytes)
val crc16 =... | fim | zio/zio | scala |
<|fim_suffix|> assertTrue(bytes.length.toLong == length)
}
}
}
)
)
}
<|fim_prefix|>package zio.stream
import zio._
import zio.test._
import java.nio.charset.StandardCharsets.UTF_8
import java.nio.file.Files
object ZSinkPlatformSpecific2Spec extends ZIOBaseSpec {
override def sp... | fim | zio/zio | scala |
<|fim_prefix|>package zio.stream
import zio.Clock.ClockLive
import zio._
import zio.test.Assertion._
import zio.test.TestAspect._
import zio.test._
import java.io._
import java.nio.charset.StandardCharsets
import java.nio.file.{Files, NoSuchFileException, Paths}
object ZStreamPlatformSpecific2Spec extends ZIOBaseSpe... | fim | zio/zio | scala |
<|fim_prefix|>import zio.test._
import scala.annotation.nowarn
object StreamREPLSpec extends ZIOSpecDefault {
def spec = suite("StreamREPLSpec")(
test("settings compile") {
import zio._
@nowarn("msg=never used")
implicit class RunSyntax[A](io: ZIO[Any, Any, A]) {
def unsafeRun: A =
... | fim | zio/zio | scala |
<|fim_suffix|>interruption extends ZIOTag { override val value = "interruption" }
case object regression extends ZIOTag { override val value = "regression" }
case object supervision extends ZIOTag { override val value = "supervision" }
}
def zioTag(zioTag: ZIOTag, zioTags: ZIOTag*): TestAspectPoly = ... | fim | zio/zio | scala |
<|fim_suffix|>
sink2: ZSink[Any, E, A, A, C]
): UIO[TestResult] =
for {
zb <- s.run(sink1).either
zc <- s.run(sink2).either
zbc <- s.run(sink1.zipPar(sink2)).either
} yield {
zbc match {
case Left(e) => assert(zb)(equalTo(Left(e))) || assert(zc)(equalTo(Left(e)))
... | fim | zio/zio | scala |
<|fim_suffix|>O(s)((st: Int, _: Int) => ZIO.succeed(st))),
lazy1[Int]("scan")(s => ZStream(1).scan(s)((st: Int, _: Int) => st)),
lazy1[Int]("scanZIO")(s => ZStream(1).scanZIO(s)((st: Int, _: Int) => ZIO.succeed(st))),
lazy1("schedule")(ZStream.empty.schedule(_)),
lazy1("sliding")(ZStream... | fim | zio/zio | scala |
<|fim_suffix|>values1 <- subscriber1.join
values2 <- subscriber2.join
} yield assert(values1)(equalTo(Chunk(0, 1, 2))) &&
assert(values2)(equalTo(Chunk(1, 2)))
},
test("subscriptions are interruptible") {
for {
subscriptionRef <- SubscriptionRef.... | fim | zio/zio | scala |
<|fim_suffix|>test("Data that happens to start with BOM") {
testDecoderUsing(
ZPipeline.utf32LEDecode,
CharsetUtf32LE,
Gen.const(BOM.Utf32LE ++ Chunk[Byte](97, 0, 0, 0, 98, 0, 0, 0))
)
},
test("Data that happens to start with BOM, wit... | fim | zio/zio | scala |
<|fim_prefix|>package zio.stream
import zio.stream.ZChannelSimulatedChecks.Simulation.{opsToDoneChannel, opsToEffect, opsToOutChannel}
import zio.test.Assertion._
import zio.test._
import zio.{Chunk, IO, ZIO, ZIOBaseSpec}
object ZChannelSimulatedChecks extends ZIOBaseSpec {
override def spec =
suite("ZChannel s... | fim | zio/zio | scala |
<|fim_prefix|>package zio.stream
import zio._
import zio.test.Assertion._
import zio.test.TestAspect.{exceptJS, jvmOnly, nonFlaky, timeout}
import zio.test._
import zio.Clock.ClockLive
object ZChannelSpec extends ZIOBaseSpec {
import ZIOTag._
def spec = suite("ZChannelSpec")(
suite("interpreter")(
test... | fim | zio/zio | scala |
<|fim_prefix|>package zio.stream
import zio._
import zio.stream.encoding.EncodingException
import zio.test.Assertion.{equalTo, fails, isEmpty}
import zio.test._
import java.nio.charset.Charset
import scala.io.Source
object ZPipelineSpec extends ZIOBaseSpec {
def spec =
suite("ZPipelineSpec")(
suite("grou... | fim | zio/zio | scala |
<|fim_prefix|>package zio.stream
import zio._
import zio.stream.SinkUtils._
import zio.test.Assertion._
import zio.test.TestAspect.jvmOnly
import zio.test._
object ZSinkSpec extends ZIOBaseSpec {
import ZIOTag._
def spec = {
suite("ZSinkSpec")(
suite("Constructors")(
suite("drain")(
... | fim | zio/zio | scala |
<|fim_suffix|>berRef.currentTags.get
} yield assertTrue(
result.is(_.some) == Set(serviceTag),
tagsBefore.isEmpty,
tagsAfter.isEmpty
)
},
test("multiple tags accumulate") {
val aspect = ZStreamAspect.tagged("first", "1") @@ ZStreamAspect.... | fim | zio/zio | scala |
<|fim_prefix|>package zio.stream
import zio._
import zio.test.{Gen, GenZIO}
object ZStreamGen extends GenZIO {
def tinyListOf[R, A](g: Gen[R, A]): Gen[R, List[A]] =
Gen.listOfBounded(0, 5)<|fim_suffix|>unk.length - 1 max 0)
(l, r) = chunk.splitAt(j)
split = chunks.take(i) ++ Chunk(l) ++ Chunk(r... | fim | zio/zio | scala |
<|fim_prefix|>package zio.stream
impor<|fim_suffix|> .mapZIOParUnordered(20)(ZIO.succeed(_))
.runCollect
.either
}
.as(assertCompletes)
}
) @@ timeout(10.seconds) @@ sequential @@ jvmOnly
}
<|fim_middle|>t zio._
import zio.test.TestAspect._
import zio.test._
object ... | fim | zio/zio | scala |
<|fim_prefix|>/*
* Copyright 2021-2024 John A. De G<|fim_suffix|>ion)(implicit unsafe: Unsafe): Scheduler.CancelToken = {
val fiber =
runtime.unsafe.fork(sleep(duration) *> ZIO.succeed(runnable.run()))
() => runtime.unsafe.run(fiber.interruptAs(zio.FiberId.None)).getOrThrowFiberFailure(... | fim | zio/zio | scala |
<|fim_suffix|>e: String, searchString: String, lock: TestDebugFileLock) =
ZIO.unit
def createDebugFile(fullyQualifiedTaskName: String): ZIO[Any, Nothing, Unit] =
ZIO.unit
def deleteIfEmpty(fullyQualifiedTaskName: String): ZIO[Any, Nothing, Unit] = ZIO.unit
}
<|fim_prefix|>package zio.test
import zio.{Ref... | fim | zio/zio | scala |
<|fim_prefix|>/*
* Copyright 2019-2024 John A. De Goes<|fim_suffix|> final val isJS = true
/**
* Returns whether the currently platform is the JVM.
*/
final val isJVM = false
/**
* Returns whether the current platform is Scala Native.
*/
final val isNative = false
}
<|fim_middle|> and the ZIO Con... | fim | zio/zio | scala |
<|fim_suffix|> case class Json() extends ResultFileOps {
def write(content: => String, append: Boolean): ZIO[Any, IOException, Unit] =
ZIO.unit
}
}
<|fim_prefix|>package zio.test.results
import zio._
import java.io.IOException
private[test] trait ResultFileOps {
def write(content: => String, append: Bo... | fim | zio/zio | scala |
<|fim_suffix|>zer.render(event), append = true).orDie
}
}
<|fim_prefix|>package zio.test.results
import zio._
import zio.test._
private[test] object ResultPrinterJson {
def live(jsonResultPath: String): ZLayer[Any, Nothing, ResultPrinter] =
ZLayer.make[ResultPrinter](
ResultSerializer.live,
Result... | fim | zio/zio | scala |
<|fim_prefix|>/*
* Copyright 2019-2024 John A. De Goes and the ZIO Contributors
*
* Licensed under t<|fim_suffix|>cense");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by appli... | fim | zio/zio | scala |
<|fim_suffix|>ibuted on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package zio.test
import zio.stacktracer.TracingImplicits.disableAutoTrace
/**
* `TestPlat... | fim | zio/zio | scala |
/*
* Copyright 2019-2024 John A. De Goes and the ZIO Contributors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless requir... | fim | zio/zio | scala |
<|fim_prefix|>/*
* Copyright 2021-2024 John A. De Goes and the ZIO Contributors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
*... | fim | zio/zio | scala |
<|fim_prefix|>package zio.test
import zio.{Unsafe, ZIO}
import zio.internal.Platform
import java.io.{File, PrintWriter}
import java.nio.file.{Files, Paths}
import scala.io.Source
private[test] object TestDebug {
private val outputDirectory = "target/test-reports-zio"
private def outputFileForTask(... | fim | zio/zio | scala |
<|fim_prefix|>package zio.test.results
import zio._
import java.util.concurrent.ConcurrentLinkedQueue
private[test] trait ResultFileOps {
def write(content: => String): UIO[Unit]
}
private[test] object ResultFileOps {
def live(jsonResultPath: String): ZLayer[Any, Nothing, ResultFileOps] =
ZLayer.scoped(Json... | fim | zio/zio | scala |
<|fim_suffix|>leOps.write(serializer.render(event))
}
}
<|fim_prefix|>package zio.test.results
import zio.test._
import zio.{ZIO, ZLayer}
private[test] object ResultPrinterJson {
def live(jsonResultPath: String): ZLayer[Any, Nothing, ResultPrinter] =
ZLayer.make[ResultPrinter](
ResultSerializer.live,
... | fim | zio/zio | scala |
<|fim_prefix|>/*
* Copyright 2019-2024 John A. De Goes and the ZIO Contributors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
*... | fim | zio/zio | scala |
<|fim_suffix|>guage governing permissions and
* limitations under the License.
*/
package zio.test
import zio.stacktracer.TracingImplicits.disableAutoTrace
private[test] trait FieldExtractorPlatformSpecific {
def productFields(obj: Product): Iterator[String] = Iterator.fill(obj.productArity)("")
}
<|fim_prefix|>... | fim | zio/zio | scala |
<|fim_suffix|>n[V])(implicit trace: Trace): UIO[V] =
annotationsWith(_.get(key))
/**
* Returns a set of all fibers in this test.
*/
def supervisedFibers(implicit trace: Trace): UIO[SortedSet[Fiber.Runtime[Any, Any]]] =
annotationsWith(_.supervisedFibers)
/**
* Constructs a new `Annotations` ser... | fim | zio/zio | scala |
<|fim_suffix|>) >>> assertion.arrow
)
/**
* Makes a new assertion that requires the expression to throw an instance of
* given type (or its subtype).
*/
def throwsA[E: ClassTag]: Assertion[Any] =
throws(isSubtype[E](anything))
/**
* Makes a new assertion that requires an exit value to be int... | fim | zio/zio | scala |
<|fim_prefix|>package zio.test
import zio.{Scope, ZIO, Trace}
import zio.stacktracer.TracingImplicits.disableAutoTrace
import zio.stm.ZSTM
trait CheckConstructor[Environment, In] {
type OutEnvironment <: Environment
type OutError
def apply(input: => In)(implicit trace: Trace): ZIO[OutEnvironment, OutError, Test... | fim | zio/zio | scala |
<|fim_suffix|>nd
* limitations under the License.
*/
package zio.test
import zio.stacktracer.TracingImplicits.disableAutoTrace
import java.util.concurrent.{ConcurrentHashMap => JConcurrentHashMap}
private[test] final case class ConcurrentHashMap[K, V] private (private val map: JConcurrentHashMap[K, V]) {
def fo... | fim | zio/zio | scala |
<|fim_suffix|> extends ConsoleIO
}
<|fim_prefix|>package zio.test
private[test] sealed trait ConsoleIO
pr<|fim_middle|>ivate[test] object ConsoleIO {
case class Input(line: String) extends ConsoleIO
case class Output(line: String)<|endoftext|> | fim | zio/zio | scala |
<|fim_suffix|>ErrorMessage): ErrorMessage = ErrorMessage.CombineMessage(self, that)
private[test] def render(isSuccess: Boolean): Message =
self match {
case ErrorMessage.Custom(custom) =>
Message(custom.split("\n").toIndexedSeq.map(Fragment(_).toLine))
case ErrorMessage.Choice(success, fail... | fim | zio/zio | scala |
<|fim_prefix|>package zio.test
object ExecutionEvent {
final case class TestStarted(
labelsReversed: List[String],
annotations: TestAnnotationMap,
ancestors: List[SuiteId],
id: SuiteId,
fullyQualifiedName: String
) extends ExecutionEvent {
val labels: List[String] = labelsReversed.reverse
... | fim | zio/zio | scala |
<|fim_suffix|> .unit
}
}
}
<|fim_prefix|>package zio.test
import zio._
private[test] trait ExecutionEventConsolePrinter {
def print(event: ExecutionEvent): ZIO[Any, Nothing, Unit]
}
private[test] object ExecutionEventConsolePrinter {
def live(renderer: ReporterEventRenderer): ZLayer[TestLogger, Nothing... | fim | zio/zio | scala |
<|fim_suffix|> trait ExecutionEventPrinter {
def print(event: ExecutionEvent): ZIO[Any, Nothing, Unit]
}
private[test] object ExecutionEventPrinter {
case class Live(console: ExecutionEventConsolePrinter, file: ResultPrinter) extends ExecutionEventPrinter {
override def print(event: ExecutionEvent): ZIO[Any, N... | fim | zio/zio | scala |
<|fim_prefix|>package zio.test
import zio.{Console, Ref, UIO, ULayer, Unsafe, ZIO, ZLayer}
trait ExecutionEventSink {
def getSummary: UIO[Summary]
def process(event: ExecutionEvent): ZIO[Any, Nothing, Unit]
}
object ExecutionEventSink {
def getSummary: ZIO[ExecutionEventSink, Nothing, Summary] =
ZIO.servic... | fim | zio/zio | scala |
<|fim_prefix|>/*
* Copyright 2019-2024 John A. De Goes and the ZIO Contributors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
*... | fim | zio/zio | scala |
<|fim_prefix|>/*
* Copyright 2019-2024 John A. De Goes and the ZIO Contributors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use t<|fim_suffix|>ashCode` in a way that is consistent with equality.
*/
def makeHash[R, A, B](f: A => URIO[R, B])(hash: A => Int)(implicit trace: T... | fim | zio/zio | scala |
<|fim_prefix|>/*
* Copyright 2019-2024 John A. De Goes and the ZIO Contributors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
*... | fim | zio/zio | scala |
<|fim_suffix|>
def mapOf1[R, A, B](key: Gen[R, A], value: Gen[R, B])(implicit
trace: Trace
): Gen[R, Map[A, B]] =
small(mapOfN(_)(key, value), min = 1)
/**
* A generator of maps of the specified size.
*/
def mapOfN[R, A, B](n: Int)(key: Gen[R, A], value: Gen[R, B])(implicit
trace: Trace
): ... | fim | zio/zio | scala |
/*
* Copyright 2019-2024 John A. De Goes and the ZIO Contributors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless requir... | fim | zio/zio | scala |
<|fim_suffix|>r)
}
def parallel(n: Int) = Gen.suspend {
for {
i <- Gen.int(1, n - 1)
l <- causesN(i)
r <- causesN(n - i)
} yield Cause.Both(l, r)
}
def causesN(n: Int): Gen[R, Cause[E]] = Gen.suspend {
if (n == 1) Gen.oneOf(empty, failure, die, interrupt)
... | fim | zio/zio | scala |
<|fim_suffix|>ck with Console with System with Random]) extends Live {
def provide[R, E, A](zio: ZIO[R, E, A])(implicit trace: Trace): ZIO[R, E, A] =
DefaultServices.currentServices.locallyWith(_.unionAll(zenv))(zio)
}
/**
* Constructs a new `Live` service that implements the `Live` interface. This
... | fim | zio/zio | scala |
<|fim_suffix|>, ${PrettyPrint(tuple15._15)})"
case tuple16: (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) =>
s"(${PrettyPrint(tuple16._1)}, ${PrettyPrint(tuple16._2)}, ${PrettyPrint(tuple16._3)}, ${PrettyPrint(tuple16._4)}, ${PrettyPrint(tuple16._5)}, ${PrettyPrint(tuple16._6)}, ${PrettyPrint(tuple16._... | fim | zio/zio | scala |
<|fim_prefix|>/*
* Copyright 2019-2024 John A. De Goes and the ZIO Contributors
*
* Licensed under the Apache License, Version 2.0 (the<|fim_suffix|>tring): String =
SConsole.BOLD + s + SConsole.RESET
def ansi(ansiColor: String, s: String): String =
ansiColor + s + SConsole.RESET
}
<|fim_middle|> "License... | fim | zio/zio | scala |
<|fim_suffix|>(executionEvent, includeCause = true)
)
}
}
<|fim_prefix|>package zio.test
import zio.stacktracer.TracingImplicits.disableAutoTrace
import zio.{Chunk, Trace}
import zio.test.render.{ConsoleRenderer, IntelliJRenderer}
trait ReporterEventRenderer {
def render(event: ExecutionEvent)(implicit trac... | fim | zio/zio | scala |
<|fim_suffix|>DITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package zio.test
import zio.{UIO, Trace}
import zio.stacktracer.TracingImplicits.disableAutoTrace
trait Restorable extends Serializable {
def sa... | fim | zio/zio | scala |
<|fim_prefix|>package zio.test
import zio.Chunk
import zio.internal.ansi.AnsiStringOps
import zio.stacktracer.TracingImplicits.disableAutoTrace
import zio.test.TestArrow.Span
import zio.test.ConsoleUtils._
import zio.test.render.LogLine.Message
import scala.annotation.tailrec
sealed trait Result[+A] { self =>
def ... | fim | zio/zio | scala |
<|fim_suffix|> else if (F.toDouble(F.abs(F.minus(max, mid))) < 0.001) Some((min, max))
else Some((mid, mid))
}
)
}
def shrinkIntegral[A](smallest: A)(a: A)(implicit I: Integral[A], trace: Trace): Sample[Any, A] =
Sample.unfold(a) { max =>
(
max,
ZStream.unfold(... | fim | zio/zio | scala |
package zio.test
import zio._
import zio.stream.ZStream
import zio.stacktracer.TracingImplicits.disableAutoTrace
trait Sized extends Serializable {
def size(implicit trace: Trace): UIO[Int]
def withSize[R, E, A](size: Int)(zio: ZIO[R, E, A])(implicit trace: Trace): ZIO[R, E, A]
def withSizeGen[R, A](size: Int)(... | fim | zio/zio | scala |
<|fim_suffix|>refix).map(Spec.labeled(label, _))
case ScopedCase(scoped) =>
Some(Spec.scoped[R](scoped.map(_.filterLabels(f, prefix, accumulatePrefix).getOrElse(Spec.empty))))
case MultipleCase(specs) =>
val filtered = specs.flatMap(_.filterLabels(f, prefix, accumulatePrefix))
if (fi... | fim | zio/zio | scala |
<|fim_prefix|>package zio.test
import zio.{Chunk, S<|fim_suffix|>[Spec[R, E]], R, E] =
new SuiteConstructor[Collection[Spec[R, E]]] {
type OutEnvironment = R
type OutError = E
def apply(spec: Collection[Spec[R, E]])(implicit trace: Trace): Spec[R, E] =
Spec.multiple(Chunk.fromIterab... | fim | zio/zio | scala |
<|fim_suffix|>afe: Unsafe): SuiteId =
SuiteId(counter.getAndIncrement())
}
<|fim_prefix|>package zio.test
import zio.{Random, Unsafe, ZIO}
import java.util.UUID
import java.util.concurrent.atomic.AtomicInteger
/**
* @param id
* Level of the spec nesting that you are at. Suites get new values, test
* cases... | fim | zio/zio | scala |
<|fim_suffix|> self.fail,
self.ignore,
self.failureDetails,
Interval.finite(start, end)
)
def total: Int =
success + fail + ignore
}
object Summary {
def apply(
success: Int,
fail: Int,
ignore: Int,
failureDetails: String,
interval0: Interval
): Summary =
new ... | fim | zio/zio | scala |
<|fim_suffix|>e 0
case RuntimeFailure(_, _, _, _) =>
0
case SectionStart(_, _, _) => 0
case SectionEnd(_, _, _) => 0
case TopLevelFlush(_) => 0
case TestStarted(_, _, _, _, _) =>
0
}
private def extractFailures(reporterEvent: ExecutionEvent): Seq[ExecutionEve... | fim | zio/zio | scala |
<|fim_suffix|> /**
* An annotation which counts repeated tests.
*/
val repeated: TestAnnotation[Int] =
TestAnnotation("repeated", 0, _ + _)
/**
* An annotation which counts retried tests.
*/
val retried: TestAnnotation[Int] =
TestAnnotation("retried", 0, _ + _)
/**
* An annotation which... | fim | zio/zio | scala |
<|fim_prefix|>/*
* Copyright 2019-2024 John A. De Goes and the ZIO Contributors
*
* Licensed under the Apache License, Version 2.0 (the "Li<|fim_suffix|> writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
... | fim | zio/zio | scala |
<|fim_suffix|>: TestAnnotationRenderer =
LeafRenderer(TestAnnotation.repeated) { case (child :: _) =>
if (child == 0) None
else Some(s"repeated: $child")
}
/**
* A test annotation renderer that renders how many times a test had to be
* retried before it succeeded.
*/
val retried: TestA... | fim | zio/zio | scala |
<|fim_suffix|>(_._1)
.map { case (k, v) =>
(k, v.map(_._2))
}
val terms = parsedArgs.getOrElse("testSearchTerm", Nil)
val tags = parsedArgs.getOrElse("tagSearchTerm", Nil)
val ignoreTags = parsedArgs.getOrElse("tagIgnoreTerm", Nil)
val testTaskPolicy = parsedA... | fim | zio/zio | scala |
<|fim_suffix|>[A](left: TestArrow[A, Boolean], right: TestArrow[A, Boolean]) extends TestArrow[A, Boolean]
case class Not[A](arrow: TestArrow[A, Boolean]) extends TestArrow[A, Boolean]
case class Suspend[A, B](f: A => TestArrow[Any, B]) extends TestArrow[A, B]
... | fim | zio/zio | scala |
<|fim_suffix|>that runs tests with the live clock service.
*/
val withLiveClock: TestAspectPoly =
new TestAspectPoly {
implicit private val trace: Trace = Trace.empty
private val layer = ZLayer.scoped(ZIO.withClockScoped(ClockLive))
def some[R, E](spec: Spec[R, E])(implicit tr... | fim | zio/zio | scala |
<|fim_prefix|>/*
* Copyright 2019-2024 John A. De Goes and the ZIO Contributors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
*... | fim | zio/zio | scala |
<|fim_suffix|>, checkAspect)
withTestConfigScoped(testConfig).as(testConfig)
}
/**
* The number of times to repeat tests to ensure they are stable.
*/
def repeats(implicit trace: Trace): URIO[Any, Int] =
testConfigWith(testConfig => Exit.succeed(testConfig.repeats))
/**
* The number of ti... | fim | zio/zio | scala |
<|fim_suffix|>ZIO[R, E, A])(implicit trace: Trace): ZIO[R, E, A] =
testConsoleWith(_.silent(zio))
/**
* The state of the `TestConsole`.
*/
final case class Data(
input: List[String] = List.empty,
output: Vector[String] = Vector.empty,
errOutput: Vector[String] = Vector.empty
)
}
<|fim_prefi... | fim | zio/zio | scala |
<|fim_suffix|>, trace: Trace): Spec[R, E] = {
val assertion0 = ZIO.suspendSucceed(assertion)
Spec.labeled(
label,
Spec
.test(ZTest(label, assertion0), TestAnnotationMap.empty)
.annotate(TestAnnotation.trace, sourceLocation :: Nil)
)
}
}
}
tr... | fim | zio/zio | scala |
<|fim_prefix|>package zio.test
import zio.{Ref, ZIO}
private[test] object TestDebugFileLock {
val make: ZIO[Any, Nothing, TestDebugFileLock] =
Ref.Synchronized.make[Unit](()).map(TestDebugFileLock(_))
}
private[test] case class TestDebugFileLock(lock: Ref.Synchronized[Uni<|fim_suffix|> updateFile(action: ZIO[A... | fim | zio/zio | scala |
<|fim_prefix|>package zio.test
import zio._
import java.time.Instant
sealed trait TestDuration { self =>
import TestDuration._
final def <>(that: TestDuration): TestDuration =
(self, that) match {
case (Zero, right) => right
case (<|fim_suffix|>al case class Finite(start: Instant, end: Instant) ... | fim | zio/zio | scala |
<|fim_suffix|> <- finalizer.join.whenDiscard(exit.isRight)
} yield ()
}
.catchAllCause { e =>
val event = ExecutionEvent.RuntimeFailure(sectionId, labels, TestFailure.Runtime(e), ancestors)
processEvent(event)
... | fim | zio/zio | scala |
<|fim_suffix|> "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package zio.test
import zio.{Cause, ZIO}
import zio.stacktracer.TracingImplicits.disableAutoTrace
seal... | fim | zio/zio | scala |
package zio.test
/**
* CustomAssertion allows users to create their own custom assertions for use in
* `assertTrue`. They are constructed with `CustomAssertion.make`.
*
* {{{
* // Definition
* sealed trait Pet
* case class Dog(hasBone: Boolean) extends Pet
* case class Fish(bubbles: Double) extends Pet
* case... | fim | zio/zio | scala |
<|fim_prefix|>/*
* Copyright 2019-2024 John A. De Goes and the ZIO Contribu<|fim_suffix|>
def fromConsole(console: Console)(implicit trace: Trace): ZLayer[Any, Nothing, TestLogger] =
ZLayer.succeed {
new TestLogger {
def logLine(line: String)(implicit trace: Trace): UIO[Unit] = console.printLine(l... | fim | zio/zio | scala |
<|fim_suffix|>ug: Boolean): ZIO[Any, Nothing, TestOutput] =
for {
talkers <- TestReporters.make
lock <- TestDebugFileLock.make
output <- Ref.make[Map[SuiteId, Chunk[ExecutionEvent]]](Map.empty)
} yield TestOutputLive(output, talkers, executionEventPrinter, lock, debug)
}
}
<|f... | fim | zio/zio | scala |
<|fim_suffix|> }
private def randomDouble(implicit unsafe: Unsafe): Double = {
val i1 = randomBits(26)
val i2 = randomBits(27)
((i1.toDouble * (1L << 27).toDouble) + i2.toDouble) / (1L << 53).toDouble
}
private def randomDoubleBetween(minInclusive: Double, maxExcl... | fim | zio/zio | scala |
<|fim_suffix|>}.map(_.head == id)
def relinquishPrintingControl(id: SuiteId): ZIO[Any, Nothing, Unit] =
reportersStack.updateSome {
case currentReporter :: reporters if currentReporter == id => reporters
}
}
<|fim_prefix|>package zio.test
import zio.{Ref, Unsafe, ZIO}
object TestReporters {
val ma... | fim | zio/zio | scala |
<|fim_suffix|>arallelN(4))(
implicit trace: Trace
): UIO[Summary] =
for {
start <- ClockLive.instant
summary <- executor.run(fullyQualifiedName, spec, defExec)
end <- ClockLive.instant
} yield summary.timed(start, end)
trait UnsafeAPI {
def run(spec: Spec[R, E])(implicit tra... | fim | zio/zio | scala |
<|fim_prefix|>/*
* Copyright 2017-2024 John A. De Goes and the ZIO Contributors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
*... | fim | zio/zio | scala |
<|fim_suffix|>ssions and
* limitations under the License.
*/
package zio.test
import zio.Exit
import zio.stacktracer.TracingImplicits.disableAutoTrace
sealed abstract class TestSuccess { self =>
/**
* Retrieves the annotations associated with this test success.
*/
def annotations: TestAnnotationMap
/... | fim | zio/zio | scala |
/*
* Copyright 2019-2024 John A. De Goes and the ZIO Contributors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless requir... | fim | zio/zio | scala |
<|fim_prefix|>/*
* Copyright 2019-2024 John A. De Goes and the ZIO Contributors
*
* Licensed under the Apache License, Versi<|fim_suffix|>the License.
*/
package zio.test
import zio.stacktracer.TracingImplicits.disableAutoTrace
final case class TestTimeoutException(message: String) extends Throwable(message, nul... | fim | zio/zio | scala |
<|fim_prefix|>package zio.test
import zio.stacktracer.TracingImplicits.disableAutoTrace
import zio.test.TestArrow.Span
import scala.annotation.tailrec
sealed trait TestTrace[+A] { self =>
def values: List[Any] =
self.asInstanceOf[TestTrace[Any]] match {
case TestTrace.Node(Result.Succeed(value), _, _, _... | fim | zio/zio | scala |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.