text stringlengths 14 100k | source stringclasses 1
value | repo stringclasses 810
values | language stringclasses 13
values |
|---|---|---|---|
<|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|> case Spec.LabeledCase(label, spec) => Spec.labeled(label, loop(label :: labels, spec))
case Spec.ScopedCase(scoped) => Spec.scoped[R](scoped.map(loop(labels, _)))
case Spec.MultipleCase(specs) =>
Spec.multiple(specs.map(loop(labels, _)))
case ... | 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_suffix|>yer,
testEventHandler
)
)
val randomId = "test_case_" + ThreadLocalRandom.current().nextInt()
runner.run(
randomId,
aspects.foldLeft(filteredSpec)(_ @@ _) @@ TestAspect.fibers: @nowarn("cat=deprecation")
)
}
}
@deprecated("use t... | fim | zio/zio | scala |
<|fim_suffix|>
import zio.stacktracer.TracingImplicits.disableAutoTrace
abstract class ZIOSpecDefault extends ZIOSpec[TestEnvironment] {
override val bootstrap: ZLayer[Any, Any, TestEnvironment] =
testEnvironment
def spec: Spec[TestEnvironment with Scope, Any]
}
<|fim_prefix|>pac<|fim_middle|>kage zio.test
... | fim | zio/zio | scala |
<|fim_prefix|>package zio.test
import zio.{UIO, ZIO}
trait ZTe<|fim_suffix|>
}
object ZTestEventHandler {
val silent: ZTestEventHandler = _ => ZIO.unit
}
<|fim_middle|>stEventHandler {
def handle(event: ExecutionEvent): UIO[Unit]<|endoftext|> | fim | zio/zio | scala |
package zio.test
import zio._
import scala.annotation.tailrec
/**
* A `ZTestLogger` is an implementation of a `ZLogger` that writes all log
* messages to an internal data structure. The contents of this data structure
* can be accessed using the `logOutput` operator. This makes it easy to write
* tests to verify... | fim | zio/zio | scala |
<|fim_prefix|>package zio.test.diff
import zio.stacktracer.TracingImplicits.disableAutoTrace
import zio.test.diff.Diff.DiffOps
import zio.test.internal.myers.MyersDiff
import zio.{Chunk, NonEmptyChunk}
import scala.collection.mutable.{ArrayBuffer, ListBuffer}
import scala.util.Try
trait DiffInstances extends LowPriD... | fim | zio/zio | scala |
<|fim_suffix|>se class Removed(oldValue: Any) extends DiffResult
case class Added(newValue: Any) extends DiffResult
case class Identical(value: Any) extends DiffResult
def indent(string: String, amount: Int = 2): String =
string.split("\n").toList match {
case head :: tail =>
(head +: tail.ma... | fim | zio/zio | scala |
<|fim_prefix|>package zio.test.internal
import zio.stacktracer.TracingImplicits.disableAutoTrace
trait OptionalImplicit[A] {
def value: Option[A]
}
object OptionalImplicit extends LowPriOpt<|fim_suffix|>alImplicit[A] = new OptionalImplicit[A] {
val value: Option[A] = None
}
}
<|fim_middle|>ionalImplicit {
... | fim | zio/zio | scala |
<|fim_prefix|>package zio.test.internal
import zio.stacktracer.TracingImplicits.disableAutoTrace
import zio._
import zio.internal.ansi.AnsiStringOps
import zio.test.diff.{Diff, DiffResult}
import scala.reflect.ClassTag
import scala.util.{Failure, Success, Try}
import zio.test.{ErrorMessage => M, SmartAssertionOps => ... | fim | zio/zio | scala |
<|fim_suffix|> myersMatrix(i + 1)(j + 1) = myersMatrix(i)(j + 1)
} else {
myersMatrix(i + 1)(j + 1) = myersMatrix(i + 1)(j)
}
}
}
}
myersMatrix
}
}
<|fim_prefix|>/*
* Copyright 2019-2024 John A. De Goes and the ZIO Contributors
*
* Licensed under the Apache... | fim | zio/zio | scala |
<|fim_suffix|>, ({ type lambda[+x] = Map[A, x] })#lambda] {
def apply[R1 <: R, B](b: Gen[R1, B])(implicit trace: Trace): Gen[R1, Map[A, B]] =
Gen.mapOf(a, b)
}
/**
* A generator of `Option` values.
*/
val option: GenF[Any, Option] =
new GenF[Any, Option] {
def apply[R1, A](gen: Ge... | fim | zio/zio | scala |
<|fim_prefix|>/*
* Copyright 2020-2024 John A. De Goes and the ZIO Contributors
*
* Licensed under the Apache License, Version<|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.la... | fim | zio/zio | scala |
/*
* 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
*
* Unless requir... | fim | zio/zio | scala |
/*
* 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
*
* Unless requir... | fim | zio/zio | scala |
<|fim_suffix|>KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package zio.test.laws
import zio.stacktracer.TracingImplicits.disableAutoTrace
/**
* `ZLawfulF[CapsF, Caps, R]` describes a set of laws that a parameterized typ... | 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 |
/*
* 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
*
* Unless requir... | fim | zio/zio | scala |
<|fim_suffix|>x], CapsRight1[x] <: CapsRight[x], R1 <: R](
that: ZLaws2[CapsBoth1, CapsLeft1, CapsRight1, R1]
): ZLaws2[CapsBoth1, CapsLeft1, CapsRight1, R1] =
ZLaws2.Both(self, that)
}
object ZLaws2 {
private final case class Both[-CapsBoth[_, _], -CapsLeft[_], -CapsRight[_], -R](
left: ZLaws2[CapsBo... | fim | zio/zio | scala |
<|fim_suffix|> )(implicit trace: Trace): URIO[R, TestResult] =
check(genF(gen), genF(gen), genF(gen))(apply(_, _, _).label(label))
}
/**
* Constructs a law from an effectual function taking three parameters.
*/
abstract class Law3ZIO[-CapsF[_[-_]], -Caps[_], -R](label: String) extends Co... | 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|>IO[R1, Nothing, TestResult] =
lawful.laws.run(gen)
/**
* Checks that all values generated by a the specified generator satisfy the
* expected behavior of the lawful instance.
*/
def checkAllLaws[CapsBoth[_, _], CapsLeft[_], CapsRight[_], R, R1 <: R, A: CapsLeft, B: CapsRight](
lawful... | 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|>ly[A](gen: Gen[Any, A], num: Fractional[A]): GenFractionalPoly =
new GenFractionalPoly {
type T = A
val genT = gen
val numT = num
}
/**
* Provides evidence that instances of `Gen` and `Fractional` exist for
* doubles.
*/
def double(implicit trace: Trace): GenFractio... | fim | zio/zio | scala |
<|fim_suffix|>short, Numeric.ShortIsIntegral)
}
<|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
<|fim_midd... | fim | zio/zio | scala |
<|fim_suffix|>crete but unknown type `T`.
*/
trait GenNumericPoly extends GenOrderingPoly {
val numT: Numeric[T]
override final val ordT: Ordering[T] = numT
}
object GenNumericPoly {
/**
* Constructs an instance of `GenIntegralPoly` using the specified `Gen` and
* `Numeric` instances, existentially hidin... | 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 |
/*
* 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
*
* Unless requir... | fim | zio/zio | scala |
<|fim_suffix|>: Message =
status match {
case Status.Passed => withOffset(offset)(info("+") + sp) +: message
case Status.Failed => withOffset(offset)(Line.empty) +: message
case Status.Ignored =>
withOffset(offset)(Line.empty) +: message :+ fr(" - " + TestAnnotation.ignored.identifier + " ... | 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|>onTestFinished(result: ExecutionResult, duration: Option[Long]) =
tc(s"testFinished name='${escape(result.label)}' duration='${duration.map(_.toString).getOrElse("")}'")
private def onTestIgnored(result: ExecutionResult) =
tc(s"testIgnored name='${escape(result.label)}'")
private def onTestF... | fim | zio/zio | scala |
<|fim_suffix|>nt = 0): Line = Fragment(text).toLine.withOffset(offset)
val empty: Line = Line()
}
case class Fragment(text: String, style: Style = Style.Default) { self =>
def +:(line: Line) = prepend(line)
def prepend(line: Line): Line = Line(this +: line.... | fim | zio/zio | scala |
<|fim_suffix|>)
)
case Left(TestFailure.Assertion(result, _)) =>
val flatLabel = labels.map(_.red).mkString(" / ".red.faint)
result.failures.map { result =>
renderedWithSummary(
ResultType.Test,
label,
Failed,
depth,
ren... | 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|>ure[E], TestSuccess]): String =
if (test.isRight) "Success" else "Failure"
private[results] def render(testAnnotationMap: TestAnnotationMap): String =
TestAnnotationRenderer.default
.run(List.empty, testAnnotationMap)
.map(s => s.replace("\"", "\\\""))
.mkString(" ... | fim | zio/zio | scala |
<|fim_prefix|>package zio.test.results
import zio.{ZIO, ZLayer}
import zio.test.{ExecutionEvent, TestArgs}
trait ResultPrinter {
def print[E](event: ExecutionEvent.Test[E]): ZIO[Any, Nothing, Unit]
}
object ResultPrinter {
val json: ZLayer[Any, Nothing, ResultPrinter] = json(TestArgs.reportsParentDefault)
def... | fim | zio/zio | scala |
<|fim_prefix|>/*
* Copyright 2019-2024 John A. De Goes and the <|fim_suffix|> = macro Macros.showExpression_impl
}
/**
* Proxy methods to call package private methods from the macro
*/
object CompileVariants {
def newAssertProxy[A](value: => A, codeString: String, assertionString: String)(
assertion: Asserti... | fim | zio/zio | scala |
<|fim_suffix|>nnot be equal."
)
sealed abstract class Eql[A, B]
object Eql extends EqlLowPriority {
implicit final def eqlSubtype1[A <: B, B]: Eql[A, B] = instance.asInstanceOf[Eql[A, B]]
}
private[test] sealed abstract class EqlLowPriority {
protected val instance: Eql[Any, Any] = new Eql[Any, Any] {}
implicit... | 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.{Cause, Exit}
import scala.annotation.{nowarn, tailrec}
import scala.reflect.macros.blackbox
class SmartAssertMacros(val c: blackbox.Context) {
import c.universe._
private val SA = q"_root_.zio.test.internal.SmartAssertions"
private val Arrow = q"_root_.z... | fim | zio/zio | scala |
<|fim_prefix|>package zio.test
import zio.{Chunk, ZIO}
import scala.annotation.tailrec
import scala.collection.mutable.ListBuffer
import scala.reflect.macros.wh<|fim_suffix|>tatement.Test(tree) =>
tree.tpe.typeArgs.head
}
val refined = internal.refinedType(allEnvs, c.prefix.tree.symbo... | fim | zio/zio | scala |
package zio.test
import zio._
import zio.internal.TerminalRendering
import zio.internal.macros.{LayerMacroUtils, ProvideMethod}
import zio.internal.macros.ProvideMethod.Provide
import scala.reflect.macros.blackbox
class SpecLayerMacros(val c: blackbox.Context) extends LayerMacroUtils {
type ZSpec[-R, +E, +T] = Sp... | fim | zio/zio | scala |
<|fim_suffix|>videSomeImpl[ZSpec, R0, R, E1, TestSuccess]
}
final class ProvideSomeSharedPartiallyApplied[R0, -R, +E](val self: Spec[R, E]) extends AnyVal {
def provideSomeLayerShared: Spec.ProvideSomeLayerShared[R0, R, E] =
new Spec.ProvideSomeLayerShared[R0, R, E](self)
def apply[E1 >: E](layer: ZLayer[_, E... | fim | zio/zio | scala |
<|fim_prefix|>package zio.test
private[test] trait ZIOSpecAbstractVersionSpecific {
/**
* This implicit conversion macro will ensure that the provided ZIO effect
* does not require more th<|fim_suffix|>R, E]): Spec[R1, E] =
macro SpecLayerMacros.validate[R1, R]
}
<|fim_middle|>an the provided environment... | fim | zio/zio | scala |
<|fim_prefix|>package zio.test
private[test] trait ZIOSpecVersionSpecific[R] {
// SCALA 2
def suiteAll(name: String)(spec<|fim_suffix|> Any): Spec[Nothing, Any] =
macro SmartSpecMacros.suiteImpl
}
<|fim_middle|>:<|endoftext|> | fim | zio/zio | scala |
<|fim_prefix|>package zio.test.diff
trait Diff[A] { self =>
def diff(x: A, y: A): DiffResult
final def contramap[B](f: B => A): Diff[B] =
(x, y) => self.diff<|fim_suffix|> Diff[A]): Diff[A] = diff
def render[A: Diff](oldValue: A, newValue: A): String =
(oldValue diffed newValue).render
implicit fina... | 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|>(" " * n) + _).mkString("\n")
}
<|fim_prefix|>package zio.test
import zio.internal.ansi.AnsiStringOps
import zio.stacktracer.TracingImplicits.disableAutoTrace
private[test] trait PrettyPrintVersionSpecific {
<|fim_middle|> private def labels(product: Product): Iterator[String] = {
val _ = product
... | 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|>me(s"$currClassName$paramName : expected '$subObj2' got '$subObj1'\n")
} else {
diffProduct(subObj1, subObj2, newParamName :: paramNames, Some(currClassName))
}
}
.mkString
}
case (obj1: Product, obj2: Product) if obj1.productArity == o... | fim | zio/zio | scala |
<|fim_suffix|> current Scala version is Scala 3.
*/
val isScala3: Boolean = false
}
<|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 o... | fim | zio/zio | scala |
<|fim_prefix|>package zio.test
import zio.stacktracer.TracingImplicits.disableAutoTrace
private[test] trait PrettyPrintVersionSpecific {
def prettyPrintProduct(product: Product): String = {
val name = product.productPrefix
val size = product.productArity
if (size < 1) s"$name()"
else {
val i... | 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, 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|>rargs(head +: tail) =>
tail.foldLeft(smartAssertSingle_impl(head)) { (acc, expr) =>
'{ $acc && ${ smartAssertSingle_impl(expr) } }
}
case other =>
throw new Error(s"Improper Varargs: ${other}")
}
}
object Unseal {
def unapply(using Quotes)(expr: Expr[_... | fim | zio/zio | scala |
<|fim_prefix|>package zio.test
import zio.internal.macros.LayerMacroUtils._
import scala.quoted._
import zio.internal.macros._
import zio._
object SpecLayerMacros {
def provideImpl[R0: Type, R: Type, E: Type](spec: Expr[Spec[R, E]], layer: Expr[Seq[ZLayer[_, E, _]]])(using
Quotes
): Expr[Spec[R0, E]] = {
... | fim | zio/zio | scala |
<|fim_prefix|>package zio.test
import zio.{ZIO, ZLayer}
private[test] trait SpecVersionSpecific[-R, +E] { self: Spec[R, E] =>
/**
* Automatically assembles a layer for the spec, translating it up a level.
*/
inline def provide[E1 >: E](inline layer: ZLayer[_, E1, _]*): Spec[Any, E1] =
${ SpecLayerMacro... | fim | zio/zio | scala |
<|fim_suffix|>age zio.test
import zio.stacktracer.TracingImplicits.disableAutoTrace
/**
* `TestVersion` provides information about the Scala version tests are being
* run on to enable platform specific test configuration.
*/
object TestVersion {
/**
* Returns whether the current Scala version is Scala 2.
... | fim | zio/zio | scala |
package zio.test
import scala.quoted._
import zio.internal.TerminalRendering
private[test] trait ZIOSpecAbstractVersionSpecific {
/**
* This implicit conversion macro will ensure that the provided ZIO effect
* does not require more than the provided environment.
*
* If it is missing requirements, it wi... | fim | zio/zio | scala |
<|fim_prefix|>package zio.test
import scala.quoted.*
private[test] trait ZIOSpecVersionSpecific[R] { self: ZIOSpec[R] =>
transparent inline def suiteAll(inline name: String)(inline spec: Any): Any =
${ ZIOSpecVersionSpecificMacros.suiteAllImpl('name, 'spec) }
}
private[test] object ZIOSpecVersionSpecificMacr... | fim | zio/zio | scala |
<|fim_suffix|> def isLowPriority: Boolean = false
}
object Diff extends DiffInstances {
def apply[A](implicit diff: Diff[A]): Diff[A] = diff
def render[A: Diff](oldValue: A, newValue: A): String =
(oldValue diffed newValue).render
implicit final class DiffOps[A](private val self: A)(implicit diff: Diff[A]... | fim | zio/zio | scala |
<|fim_suffix|> fireTestFailure(
label: String,
path: Vector[String],
renderedText: String,
throwable: Throwable = null
): UIO[Unit] =
succeed {
notifier.fireTestFailure(
new Failure(testDescription(label, path), new TestFailed(renderedText, throwable))
)
... | fim | zio/zio | scala |
<|fim_prefix|>package zio.test.junit
import scala.util.Try
private[zio] object ReflectionUtils {
/**
* Retrieves the companion object of the specified class, if it exists. Here
* we use plain java reflection as runtime reflection is not available for
* scala 3
*
* @param klass
* The class for w... | fim | zio/zio | scala |
<|fim_suffix|>ge, cause)
<|fim_prefix|>/*
* Copyright 2024-2024 Vincent Raman 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/lic... | fim | zio/zio | scala |
<|fim_prefix|>/*
* Copyright 2024-2024 Vincent Raman 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
*
* U... | fim | zio/zio | scala |
<|fim_prefix|>/*
* Copyright 2024-2024 Vincent Raman 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
*
* U... | fim | zio/zio | scala |
<|fim_suffix|> E, Spec[R, E]](scoped.map(spec => Spec(loop(spec, description, path))))
case Spec.MultipleCase(specs) =>
val uniqueId =
description.getUniqueId.append(ZIOSuiteTestDescriptor.segmentType, path.lastOption.getOrElse(""))
descriptor
.findByUniqueI... | fim | zio/zio | scala |
/*
* Copyright 2024-2024 Vincent Raman 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 required... | fim | zio/zio | scala |
<|fim_suffix|>ing permissions and
* limitations under the License.
*/
package zio.test.junit
import org.junit.platform.engine.support.descriptor.AbstractTestDescriptor
import org.junit.platform.engine.{TestDescriptor, TestTag, UniqueId}
import zio.test.{TestAnnotation, TestAnnotationMap}
import java.util
import sc... | fim | zio/zio | scala |
<|fim_suffix|>esult.successful())
)
case otherDesc =>
// Do nothing for other descriptor, just log it.
ZIO.logWarning(s"Found test descriptor $otherDesc that is not supported, skipping.")
} *> ZIO.succeed(listener.executionFinished(engineDesc, TestExecutionResult.s... | fim | zio/zio | scala |
<|fim_suffix|>tClass, None)
def apply(testClass: Class[_], annotations: TestAnnotationMap): TestSource =
ZIOTestSource(testClass, Some(annotations))
}
<|fim_prefix|>/*
* Copyright 2024-2024 Vincent Raman and the ZIO Contributors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may no... | fim | zio/zio | scala |
<|fim_prefix|>package zio.test.junit.maven
import zio.test.Assertion.equalTo
import zio.test.{Spec, TestEnvironment, assert, ZIOSpecDefault}
import zio.{Scope, Task, ZIO, ZLayer}
trait Ops {
def targetHost: String
}
object OpsTest extends Ops {
override def targetHost: String = null
}
trait MyService {
def rea... | fim | zio/zio | scala |
<|fim_prefix|>package zio.test.junit.maven
import zio.test.junit._
impor<|fim_suffix|>12)))
},
test("should succeed") {
assert(12)(equalTo(12))
}
)
}
<|fim_middle|>t zio.test._
import zio.test.Assertion._
object FailingSpec extends ZIOSpecDefault {
override def spec = suite("FailingSpec")(
t... | fim | zio/zio | scala |
<|fim_suffix|>tAspect.tag("b"),
test("should run for tag a b tagged") {
assert(12)(equalTo(12))
} @@ TestAspect.tag("a") @@ TestAspect.tag("b"),
) @@ TestAspect.tag("tagged")
}
<|fim_prefix|>package zio.test.junit.maven
import zio.test.ju<|fim_middle|>nit._
import zio.test._
import zio.test.Assertion.... | fim | zio/zio | scala |
<|fim_suffix|>)
.orElseFail(
new AssertionError(
"Missing project.version system property\n" +
"when running from IDE put this into `VM Parameters`: `-Dproject.version=<current zio version>`"
)
)
scalaVersion = sys.props.get("scala.version").getOrE... | fim | zio/zio | scala |
<|fim_prefix|>package zio.test.junit.maven
import zio.test.Assertion.equalTo
import zio.test.junit.JUnitRunnableSpec
import zio.test.{Spec, TestEnvironment, assert}
import zio.{Scope, Task, ZIO, ZLayer}
trait Ops {
def targetHost: String
}
object OpsTest extends Ops {
override def targetHost: String = null
}
tra... | fim | zio/zio | scala |
<|fim_prefix|>package zio.test.junit.maven
import zio.test.<|fim_suffix|>lTo(12))
}
)
}
<|fim_middle|>junit._
import zio.test._
import zio.test.Assertion._
class FailingSpec extends JUnitRunnableSpec {
override def spec = suite("FailingSpec")(
test("should fail") {
assert(11)(equalTo(12))
},
... | fim | zio/zio | scala |
<|fim_suffix|>mpatVersion = sys.props.get("scala.compat.version").getOrElse("2.12")
} yield new MavenDriver(projectDir, projectVer, scalaVersion, scalaCompatVersion)
class MavenDriver(projectDir: String, projectVersion: String, scalaVersion: String, scalaCompatVersion: String) {
val mvnRoot: String = new File(... | fim | zio/zio | scala |
package zio.test.magnolia
import magnolia1._
import zio.test.diff.{Diff, DiffResult}
object DeriveDiff extends DeriveDiff
trait DeriveDiff extends LowPri {
type Typeclass[A] = Diff[A]
def join[A](caseClass: CaseClass[Diff, A]): Diff[A] =
(x: A, y: A) => {
val fields = caseClass.parameters.map { param ... | fim | zio/zio | scala |
<|fim_suffix|>
BigDecimal(Double.MinValue) * BigDecimal(Double.MaxValue),
BigDecimal(Double.MaxValue) * BigDecimal(Double.MaxValue)
)
)
implicit val genBigInt: DeriveGen[BigInt] = instance(
Gen.bigInt(
BigInt(Int.MinValue) * BigInt(Int.MaxValue),
BigInt(Int.MaxValue) * BigInt(Int.Ma... | fim | zio/zio | scala |
<|fim_prefix|>package zio.test.magnolia
import magnolia1._
import zio.test.diff.{Diff, DiffInstances, DiffResult}
import scala.quoted._
object DeriveDiff extends AutoDerivat<|fim_suffix|>{
def join[A](caseClass: CaseClass[Diff, A]): Diff[A] =
(x: A, y: A) => {
val fields = caseClass.params.map { param =... | fim | zio/zio | scala |
<|fim_suffix|>n.function(b.derive))
given [A](using a: DeriveGen[A]): DeriveGen[Iterable[A]] =
instance(Gen.oneOf(Gen.listOf(a.derive), Gen.vectorOf(a.derive), Gen.setOf(a.derive)))
given [A](using a: DeriveGen[A]): DeriveGen[List[A]] =
instance(Gen.listOf(a.derive))
given [A](using a: DeriveGen[A]): Deri... | fim | zio/zio | scala |
<|fim_suffix|>e name of the type alias"
)
}
class TypeAndDeriveGen[A](val deriveGen: Expr[DeriveGen[A]], val tpe: Type[A])
def rec[A](using tpe: Type[A]): List[TypeAndDeriveGen[?]] =
TypeRepr.of(using tpe).dealias match {
case OrType(l, r) =>
rec(using l.asType.asInstanceOf[T... | fim | zio/zio | scala |
<|fim_prefix|>package zio.test.magnolia
import zio.test._
import DeriveDiff.gen
import java.time.Instant
object DeriveDiffSpec extends ZIOBaseSpec {
final case class Pet(name: String, hasBone: Boolean, favoriteFoods: List[String], birthday: Instant)
final case class Person(name: String, nickname: Option[String],... | fim | zio/zio | scala |
<|fim_suffix|>ssertDeriveGen[LocalTime]),
test("bigDecimal")(assertDeriveGen[BigDecimal])
),
suite("shrinking")(
test("derived generators shrink to smallest value") {
checkShrink(genPerson)(Person("", 0))
}
)
)
}
<|fim_prefix|>package zio.test.magnolia
import zio._
import zio.te... | fim | zio/zio | scala |
<|fim_suffix|>sertDeriveGen[UnionType]),
test("generates Color values") {
check(Gen.listOfN(100)(anyUnionType)) { vs =>
assertTrue(vs.exists(_.isInstanceOf[Color]))
}
},
test("generates Boolean values") {
check(Gen.listOfN(100)(anyUnionType)) { vs =>
assertT... | fim | zio/zio | scala |
<|fim_suffix|>
trait BooleanInstances {
implicit def orDeriveGen[T, A, B](implicit
raGen: DeriveGen[Refined[T, A]],
rbGen: DeriveGen[Refined[T, B]]
): DeriveGen[Refined[T, A Or B]] = {
val genA: Gen[Any, T] = raGen.derive.map(_.value)
val genB: Gen[Any, T] = rbGen.derive.map(_.value)
DeriveGen.... | fim | zio/zio | scala |
<|fim_suffix|>er))
val whitespaceGen: Gen[Any, Refined[Char, Whitespace]] =
Gen.whitespaceChars.map(char => Refined.unsafeApply(char))
implicit def digitArbitrary: DeriveGen[Refined[Char, Digit]] =
DeriveGen.instance(Gen.numericChar.map(value => Refined.unsafeApply(value)))
implicit def letterDeriveGen:... | fim | zio/zio | scala |
<|fim_suffix|>ce(
nonEmptyVectorRefinedGen(deriveGenT.derive)
)
implicit def sizedChunkRefinedDeriveGen[T, P](implicit
deriveGenT: DeriveGen[T],
deriveGenSize: DeriveGen[Int Refined P]
): DeriveGen[Refined[Chunk[T], Size[P]]] =
DeriveGen.instance(
sizedChunkRefinedGen(deriveGenT.derive,... | fim | zio/zio | scala |
<|fim_suffix|>T, U <: T](implicit
wu: Witness.Aux[U]
): Gen[Any, Refined[T, Equal[U]]] =
Gen.const(wu.value).map(Refined.unsafeApply)
implicit def equalArbitrary[T, U <: T](implicit
wu: Witness.Aux[U]
): DeriveGen[Refined[T, Equal[U]]] =
DeriveGen.instance(equalArbitraryGen(wu))
}
<|fim_prefix|>/... | 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_suffix|>fined P]
): DeriveGen[Refined[String, StartsWith[S]]] =
DeriveGen.instance(startsWithStringNGen(ws, deriveGenT.derive, deriveGenSize.derive))
}
<|fim_prefix|>/*
* Copyright 2021-2024 John A. De Goes and the ZIO Contributors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* y... | fim | zio/zio | scala |
<|fim_suffix|> with GenericInstances
with StringInstances
with NumericInstances
with AllTypesInstances
<|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... | fim | zio/zio | scala |
<|fim_suffix|>har] = Gen.alphaChar.map(v => Refined.unsafeApply(v.toUpper))
implicit val lowerCaseCharDeriveGen: DeriveGen[LowerCaseChar] = DeriveGen.instance(lowerCaseCharGen)
implicit val upperCaseCharDeriveGen: DeriveGen[UpperCaseChar] = DeriveGen.instance(upperCaseCharGen)
}
<|fim_prefix|>package zio.test.refi... | fim | zio/zio | scala |
<|fim_suffix|>pply)
val sha512Gen: Gen[Any, SHA512] = hexStringsGen(128).map(Refined.unsafeApply)
implicit val md5Arbitrary: DeriveGen[MD5] = DeriveGen.instance(md5Gen)
implicit val sha1Arbitrary: DeriveGen[SHA1] = DeriveGen.instance(sha1Gen)
implicit val sha224Arbitrary: DeriveGen[SHA224] = DeriveGe... | fim | zio/zio | scala |
<|fim_prefix|>package zio.test.refined.types
import eu.timepit.refined.api.Refined
import eu.timepit.refined.types.net._
import zio.test.Gen
import zio.test.magnolia.DeriveGen
object net extends NetInstances
trait NetInstances {
private val _0to255 = Gen.int(0, 255)
val portNumberGen: Gen[Any, PortNumber] ... | fim | zio/zio | scala |
package zio.test.refined.types
import eu.timepit.refined.api.Refined
import eu.timepit.refined.types.numeric._
import zio.test.Gen
import zio.test.magnolia.DeriveGen
object numeric extends NumericInstances
trait NumericInstances {
val posByteGen: Gen[Any, PosByte] = Gen.byte(1, Byte.MaxValue).map(Refined... | fim | zio/zio | scala |
<|fim_prefix|>package zio.test.refined.types
import eu.timepit.refined.api.Refined
import eu.timepit.refined.collection.{MaxSize, Size}
import eu.timepit.refined.nu<|fim_suffix|>
for {
i <- Gen.int(min, ws.value)
str <- Gen.stringN(i)(charGen)
} yield Refined.unsafeApply(str)
}
def f... | fim | zio/zio | scala |
<|fim_prefix|>package zio.test.refined.types
import eu.timepit.refined.api.Refined
import eu.timepit.refined.types.time.{Day, Hour, Millis, Minute, Month, Second}
import zio.test.Gen
import zio.test.magnolia.DeriveGen
object time extends TimeInstances
trait TimeInstances {
val monthGen: Gen[Any, Month] = Gen.int... | fim | zio/zio | scala |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.