Skip to content

Commit

Permalink
Remove horizontal spacing in multiline parameter blocks
Browse files Browse the repository at this point in the history
  • Loading branch information
propensive committed Feb 27, 2024
1 parent 81d873a commit 0a9dab7
Show file tree
Hide file tree
Showing 4 changed files with 67 additions and 67 deletions.
18 changes: 9 additions & 9 deletions src/bench/benchmark.scala
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,15 @@ import scala.collection.mutable as scm

extension [TestType](test: Test[TestType])
inline def benchmark[DurationType, ReportType]
( confidence: Optional[Benchmark.Percentiles] = Unset,
iterations: Optional[Int] = Unset,
duration: Optional[DurationType] = Unset,
warmup: Optional[DurationType] = Unset,
baseline: Optional[Baseline] = Unset )
( using runner: Runner[ReportType],
inc: Inclusion[ReportType, Benchmark],
specificDuration: SpecificDuration[DurationType] = timeInterfaces.long,
genericDuration: GenericDuration[DurationType] = timeInterfaces.long )
(confidence: Optional[Benchmark.Percentiles] = Unset,
iterations: Optional[Int] = Unset,
duration: Optional[DurationType] = Unset,
warmup: Optional[DurationType] = Unset,
baseline: Optional[Baseline] = Unset)
(using runner: Runner[ReportType],
inc: Inclusion[ReportType, Benchmark],
specificDuration: SpecificDuration[DurationType] = timeInterfaces.long,
genericDuration: GenericDuration[DurationType] = timeInterfaces.long)
: Unit =

val action = test.action
Expand Down
62 changes: 31 additions & 31 deletions src/core/macros.scala
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@ import scala.quoted.*

object Probably:
protected def general[TestType: Type, ReportType: Type, ResultType: Type]
( test: Expr[Test[TestType]],
predicate: Expr[TestType => Boolean],
runner: Expr[Runner[ReportType]],
inc: Expr[Inclusion[ReportType, Outcome]],
inc2: Expr[Inclusion[ReportType, DebugInfo]],
action: Expr[TestRun[TestType] => ResultType])
(test: Expr[Test[TestType]],
predicate: Expr[TestType => Boolean],
runner: Expr[Runner[ReportType]],
inc: Expr[Inclusion[ReportType, Outcome]],
inc2: Expr[Inclusion[ReportType, DebugInfo]],
action: Expr[TestRun[TestType] => ResultType])
(using Quotes)
: Expr[ResultType] =

Expand Down Expand Up @@ -69,31 +69,31 @@ object Probably:
}

def check[TestType: Type, ReportType: Type]
( test: Expr[Test[TestType]],
predicate: Expr[TestType => Boolean],
runner: Expr[Runner[ReportType]],
inc: Expr[Inclusion[ReportType, Outcome]],
inc2: Expr[Inclusion[ReportType, DebugInfo]] )
(test: Expr[Test[TestType]],
predicate: Expr[TestType => Boolean],
runner: Expr[Runner[ReportType]],
inc: Expr[Inclusion[ReportType, Outcome]],
inc2: Expr[Inclusion[ReportType, DebugInfo]])
(using Quotes)
: Expr[TestType] =

general[TestType, ReportType, TestType](test, predicate, runner, inc, inc2, '{ (t: TestRun[TestType]) => t.get })

def assert[TestType: Type, ReportType: Type]
( test: Expr[Test[TestType]],
predicate: Expr[TestType => Boolean],
runner: Expr[Runner[ReportType]],
inc: Expr[Inclusion[ReportType, Outcome]],
inc2: Expr[Inclusion[ReportType, DebugInfo]] )
(test: Expr[Test[TestType]],
predicate: Expr[TestType => Boolean],
runner: Expr[Runner[ReportType]],
inc: Expr[Inclusion[ReportType, Outcome]],
inc2: Expr[Inclusion[ReportType, DebugInfo]])
(using Quotes)
: Expr[Unit] =
: Expr[Unit] =
general[TestType, ReportType, Unit](test, predicate, runner, inc, inc2, '{ (t: TestRun[TestType]) => () })

def aspire[TestType: Type, ReportType: Type]
( test: Expr[Test[TestType]],
runner: Expr[Runner[ReportType]],
inc: Expr[Inclusion[ReportType, Outcome]],
inc2: Expr[Inclusion[ReportType, DebugInfo]] )
(test: Expr[Test[TestType]],
runner: Expr[Runner[ReportType]],
inc: Expr[Inclusion[ReportType, Outcome]],
inc2: Expr[Inclusion[ReportType, DebugInfo]])
(using Quotes)
: Expr[Unit] =

Expand All @@ -102,16 +102,16 @@ object Probably:
def succeed: Any => Boolean = (value: Any) => true

def assertion[TestType, TestType2 <: TestType, ReportType, ResultType]
( runner: Runner[ReportType],
test: Test[TestType2],
predicate: TestType2 => Boolean,
result: TestRun[TestType2] => ResultType,
contrast: Contrast[TestType],
exp: Option[TestType],
inc: Inclusion[ReportType, Outcome],
inc2: Inclusion[ReportType, DebugInfo],
display: Debug[TestType] )
: ResultType =
(runner: Runner[ReportType],
test: Test[TestType2],
predicate: TestType2 => Boolean,
result: TestRun[TestType2] => ResultType,
contrast: Contrast[TestType],
exp: Option[TestType],
inc: Inclusion[ReportType, Outcome],
inc2: Inclusion[ReportType, DebugInfo],
display: Debug[TestType])
: ResultType =

runner.run(test).pipe: run =>
val outcome = run match
Expand Down
30 changes: 15 additions & 15 deletions src/core/probably.scala
Original file line number Diff line number Diff line change
Expand Up @@ -154,39 +154,39 @@ extension [TestType](test: Test[TestType])

inline def assert[ReportType]
(inline predicate: TestType => Boolean)
( using runner: Runner[ReportType],
inclusion: Inclusion[ReportType, Outcome],
inclusion2: Inclusion[ReportType, DebugInfo] )
(using runner: Runner[ReportType],
inclusion: Inclusion[ReportType, Outcome],
inclusion2: Inclusion[ReportType, DebugInfo])
: Unit =
${Probably.assert[TestType, ReportType]('test, 'predicate, 'runner, 'inclusion, 'inclusion2)}

inline def check[ReportType]
(inline predicate: TestType => Boolean)
( using runner: Runner[ReportType],
inclusion: Inclusion[ReportType, Outcome],
inclusion2: Inclusion[ReportType, DebugInfo] )
(using runner: Runner[ReportType],
inclusion: Inclusion[ReportType, Outcome],
inclusion2: Inclusion[ReportType, DebugInfo])
: TestType =
${Probably.check[TestType, ReportType]('test, 'predicate, 'runner, 'inclusion, 'inclusion2)}

inline def assert[ReportType]()
( using runner: Runner[ReportType],
inclusion: Inclusion[ReportType, Outcome],
inclusion2: Inclusion[ReportType, DebugInfo] )
(using runner: Runner[ReportType],
inclusion: Inclusion[ReportType, Outcome],
inclusion2: Inclusion[ReportType, DebugInfo])
: Unit =
${Probably.assert[TestType, ReportType]('test, '{Probably.succeed}, 'runner, 'inclusion, 'inclusion2)}

inline def check[ReportType]()
( using runner: Runner[ReportType],
inclusion: Inclusion[ReportType, Outcome],
inclusion2: Inclusion[ReportType, DebugInfo] )
(using runner: Runner[ReportType],
inclusion: Inclusion[ReportType, Outcome],
inclusion2: Inclusion[ReportType, DebugInfo])
: TestType =

${Probably.check[TestType, ReportType]('test, '{Probably.succeed}, 'runner, 'inclusion, 'inclusion2)}

inline def matches[ReportType](inline pf: PartialFunction[TestType, Any])
( using runner: Runner[ReportType],
inc: Inclusion[ReportType, Outcome],
inc2: Inclusion[ReportType, DebugInfo] )
(using runner: Runner[ReportType],
inc: Inclusion[ReportType, Outcome],
inc2: Inclusion[ReportType, DebugInfo])
: Unit =

assert[ReportType](pf.isDefinedAt(_))
24 changes: 12 additions & 12 deletions src/coverage/coverage.scala
Original file line number Diff line number Diff line change
Expand Up @@ -31,18 +31,18 @@ object Juncture:
given Ordering[Juncture] = Ordering.by[Juncture, Int](_.start).orElseBy(-_.end)

case class Juncture
( id: Int,
path: Text,
className: Text,
methodName: Text,
start: Int,
end: Int,
lineNo: Int,
symbolName: Text,
treeName: Text,
branch: Boolean,
ignored: Boolean,
code: List[Text] ):
(id: Int,
path: Text,
className: Text,
methodName: Text,
start: Int,
end: Int,
lineNo: Int,
symbolName: Text,
treeName: Text,
branch: Boolean,
ignored: Boolean,
code: List[Text]):

def contains(right: Juncture): Boolean =
(right.start >= start && right.end <= end && !(right.start == start && right.end == end)) ||
Expand Down

0 comments on commit 0a9dab7

Please sign in to comment.