From 5d4b11d9491324ec95649ecfc2db47b39c3ff46d Mon Sep 17 00:00:00 2001 From: Jamie Thompson Date: Mon, 17 Jul 2023 17:43:59 +0200 Subject: [PATCH] port library authors guide to Scala 3 --- _overviews/contributors/index.md | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/_overviews/contributors/index.md b/_overviews/contributors/index.md index 113b27838d..0460e1c4d3 100644 --- a/_overviews/contributors/index.md +++ b/_overviews/contributors/index.md @@ -473,6 +473,8 @@ code fences have been updated to also include the result of evaluating the Scala Another approach consists in embedding fragments of Scala source files that are part of a module which is compiled by your build. For instance, given the following test in file `src/test/ch/epfl/scala/Usage.scala`: +{% tabs usage-definition class=tabs-scala-version %} +{% tab 'Scala 2' %} ~~~ scala package ch.epfl.scala @@ -489,6 +491,25 @@ object Usage extends Scalaprops { } ~~~ +{% endtab %} +{% tab 'Scala 3' %} +~~~ scala +package ch.epfl.scala + +import scalaprops.{Property, Scalaprops} + +object Usage extends Scalaprops: + + val testDoNothing = +// #do-nothing + Property.forAll: (x: Int) => + Example.doNothing(x) == x +// #do-nothing + +end Usage +~~~ +{% endtab %} +{% endtabs %} You can embed the fragment surrounded by the `#do-nothing` identifiers with the `@@snip` Paradox directive, as shown in the `src/documentation/reference.md` file: