You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pekko.apache.org by jr...@apache.org on 2023/02/10 15:52:31 UTC
[incubator-pekko] branch main updated: fix Scala 2.12 / 3 version of LineNumberSpec (#165)
This is an automated email from the ASF dual-hosted git repository.
jrudolph pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-pekko.git
The following commit(s) were added to refs/heads/main by this push:
new 5a8c0146f5 fix Scala 2.12 / 3 version of LineNumberSpec (#165)
5a8c0146f5 is described below
commit 5a8c0146f5721cbd0de33477c7f6a855a6924017
Author: Johannes Rudolph <jo...@gmail.com>
AuthorDate: Fri Feb 10 16:52:24 2023 +0100
fix Scala 2.12 / 3 version of LineNumberSpec (#165)
Fixes #163
---
.../org/apache/pekko/util/LineNumberSpec.scala | 68 ------------------
.../org/apache/pekko/util/TypedMultiMapSpec.scala | 80 ----------------------
.../org/apache/pekko/util/LineNumberSpec.scala | 0
.../org/apache/pekko/util/TypedMultiMapSpec.scala | 0
.../org/apache/pekko/util/LineNumberSpec.scala | 14 ++--
5 files changed, 7 insertions(+), 155 deletions(-)
diff --git a/actor-tests/src/test/scala-2.12/org/apache/pekko/util/LineNumberSpec.scala b/actor-tests/src/test/scala-2.12/org/apache/pekko/util/LineNumberSpec.scala
deleted file mode 100644
index 2e97abc202..0000000000
--- a/actor-tests/src/test/scala-2.12/org/apache/pekko/util/LineNumberSpec.scala
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * license agreements; and to You under the Apache License, version 2.0:
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * This file is part of the Apache Pekko project, derived from Akka.
- */
-
-/*
- * Copyright (C) 2014-2022 Lightbend Inc. <https://www.lightbend.com>
- */
-
-package org.apache.pekko.util
-
-import org.apache.pekko
-import pekko.testkit.PekkoSpec
-import pekko.util.LineNumbers._
-
-class LineNumberSpec extends PekkoSpec {
-
- "LineNumbers" when {
-
- "writing Scala" must {
- import LineNumberSpecCodeForScala._
-
- "work for small functions" in {
- LineNumbers(oneline) should ===(SourceFileLines("LineNumberSpecCodeForScala.scala", 13, 13))
- }
-
- "work for larger functions" in {
- val result = LineNumbers(twoline)
- result should ===(SourceFileLines("LineNumberSpecCodeForScala.scala", 15, 15))
- }
-
- "work for partial functions" in {
- LineNumbers(partial) should ===(SourceFileLines("LineNumberSpecCodeForScala.scala", 20, 22))
- }
-
- "work for `def`" in {
- val result = LineNumbers(method("foo"))
- result should ===(SourceFileLines("LineNumberSpecCodeForScala.scala", 26, 27))
- }
-
- }
-
- "writing Java" must {
- val l = new LineNumberSpecCodeForJava
-
- "work for small functions" in {
- // because how java Lambdas are implemented/designed
- LineNumbers(l.f1()) should ===(SourceFileLines("LineNumberSpecCodeForJava.java", 20, 20))
- }
-
- "work for larger functions" in {
- // because how java Lambdas are implemented/designed
- LineNumbers(l.f2()) should ===(SourceFileLines("LineNumberSpecCodeForJava.java", 25, 26))
- }
-
- "work for anonymous classes" in {
- LineNumbers(l.f3()) should ===(SourceFileLines("LineNumberSpecCodeForJava.java", 31, 36))
- }
-
- }
-
- }
-
-}
diff --git a/actor-tests/src/test/scala-2.13/org/apache/pekko/util/TypedMultiMapSpec.scala b/actor-tests/src/test/scala-2.13/org/apache/pekko/util/TypedMultiMapSpec.scala
deleted file mode 100644
index 6e9f627c7e..0000000000
--- a/actor-tests/src/test/scala-2.13/org/apache/pekko/util/TypedMultiMapSpec.scala
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * license agreements; and to You under the Apache License, version 2.0:
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * This file is part of the Apache Pekko project, derived from Akka.
- */
-
-/*
- * Copyright (C) 2015-2022 Lightbend Inc. <https://www.lightbend.com>
- */
-
-package org.apache.pekko.util
-
-import org.scalactic.TypeCheckedTripleEquals
-import org.scalatest.matchers.should.Matchers
-import org.scalatest.wordspec.AnyWordSpec
-
-object TypedMultiMapSpec {
- trait AbstractKey { type Type }
- final case class Key[T](t: T) extends AbstractKey { final override type Type = T }
- final case class MyValue[T](t: T)
-
- type KV[K <: AbstractKey] = MyValue[K#Type]
-}
-
-class TypedMultiMapSpec extends AnyWordSpec with Matchers with TypeCheckedTripleEquals {
- import TypedMultiMapSpec._
-
- "A TypedMultiMap" must {
-
- "retain and remove values for the same key" in {
- val m1 = TypedMultiMap.empty[AbstractKey, KV]
- val m2 = m1.inserted(Key(1))(MyValue(42))
- m2.get(Key(1)) should ===(Set(MyValue(42)))
- m2.removed(Key(1))(MyValue(42)).get(Key(1)) should ===(Set.empty[MyValue[Int]])
- val m3 = m2.inserted(Key(1))(MyValue(43))
- m3.get(Key(1)) should ===(Set(MyValue(42), MyValue(43)))
- m3.removed(Key(1))(MyValue(42)).get(Key(1)) should ===(Set(MyValue(43)))
- }
-
- "retain and remove values for multiple keys" in {
- val m1 = TypedMultiMap.empty[AbstractKey, KV]
- val m2 = m1.inserted(Key(1))(MyValue(42)).inserted(Key(2))(MyValue(43))
- m2.get(Key(1)) should ===(Set(MyValue(42)))
- m2.removed(Key(1))(MyValue(42)).get(Key(1)) should ===(Set.empty[MyValue[Int]])
- m2.get(Key(2)) should ===(Set(MyValue(43)))
- m2.removed(Key(1))(MyValue(42)).get(Key(2)) should ===(Set(MyValue(43)))
- }
-
- "remove a value from all keys" in {
- val m1 = TypedMultiMap.empty[AbstractKey, KV]
- val m2 = m1.inserted(Key(1))(MyValue(42)).inserted(Key(2))(MyValue(43)).inserted(Key(2))(MyValue(42))
- val m3 = m2.valueRemoved(MyValue(42))
- m3.get(Key(1)) should ===(Set.empty[MyValue[Int]])
- m3.get(Key(2)) should ===(Set(MyValue(43)))
- m3.keySet should ===(Set[AbstractKey](Key(2)))
- }
-
- "remove all values from a key" in {
- val m1 = TypedMultiMap.empty[AbstractKey, KV]
- val m2 = m1.inserted(Key(1))(MyValue(42)).inserted(Key(2))(MyValue(43)).inserted(Key(2))(MyValue(42))
- val m3 = m2.keyRemoved(Key(1))
- m3.get(Key(1)) should ===(Set.empty[MyValue[Int]])
- m3.get(Key(2)) should ===(Set(MyValue(42), MyValue(43)))
- m3.keySet should ===(Set[AbstractKey](Key(2)))
- }
-
- "reject invalid insertions" in {
- "TypedMultiMap.empty[AbstractKey, KV].inserted(Key(1))(MyValue(42L))" shouldNot compile
- }
-
- "reject invalid removals" in {
- "TypedMultiMap.empty[AbstractKey, KV].removed(Key(1))(MyValue(42L))" shouldNot compile
- }
-
- }
-
-}
diff --git a/actor-tests/src/test/scala-2.13/org/apache/pekko/util/LineNumberSpec.scala b/actor-tests/src/test/scala-2/org/apache/pekko/util/LineNumberSpec.scala
similarity index 100%
rename from actor-tests/src/test/scala-2.13/org/apache/pekko/util/LineNumberSpec.scala
rename to actor-tests/src/test/scala-2/org/apache/pekko/util/LineNumberSpec.scala
diff --git a/actor-tests/src/test/scala-2.12/org/apache/pekko/util/TypedMultiMapSpec.scala b/actor-tests/src/test/scala-2/org/apache/pekko/util/TypedMultiMapSpec.scala
similarity index 100%
rename from actor-tests/src/test/scala-2.12/org/apache/pekko/util/TypedMultiMapSpec.scala
rename to actor-tests/src/test/scala-2/org/apache/pekko/util/TypedMultiMapSpec.scala
diff --git a/actor-tests/src/test/scala-3/org/apache/pekko/util/LineNumberSpec.scala b/actor-tests/src/test/scala-3/org/apache/pekko/util/LineNumberSpec.scala
index 67ffeb0aaa..840ee90832 100644
--- a/actor-tests/src/test/scala-3/org/apache/pekko/util/LineNumberSpec.scala
+++ b/actor-tests/src/test/scala-3/org/apache/pekko/util/LineNumberSpec.scala
@@ -25,21 +25,21 @@ class LineNumberSpec extends PekkoSpec {
import LineNumberSpecCodeForScala._
"work for small functions" in {
- LineNumbers(oneline) should ===(SourceFileLines("LineNumberSpecCodeForScala.scala", 13, 13))
+ LineNumbers(oneline) should ===(SourceFileLines("LineNumberSpecCodeForScala.scala", 22, 22))
}
"work for larger functions" in {
val result = LineNumbers(twoline)
- result should ===(SourceFileLines("LineNumberSpecCodeForScala.scala", 15, 17))
+ result should ===(SourceFileLines("LineNumberSpecCodeForScala.scala", 24, 26))
}
"work for partial functions" in {
- LineNumbers(partial) should ===(SourceFileLines("LineNumberSpecCodeForScala.scala", 20, 22))
+ LineNumbers(partial) should ===(SourceFileLines("LineNumberSpecCodeForScala.scala", 29, 31))
}
"work for `def`" in {
val result = LineNumbers(method("foo"))
- result should ===(SourceFileLines("LineNumberSpecCodeForScala.scala", 25, 27))
+ result should ===(SourceFileLines("LineNumberSpecCodeForScala.scala", 34, 36))
}
}
@@ -49,16 +49,16 @@ class LineNumberSpec extends PekkoSpec {
"work for small functions" in {
// because how java Lambdas are implemented/designed
- LineNumbers(l.f1()) should ===(SourceFileLines("LineNumberSpecCodeForJava.java", 20, 20))
+ LineNumbers(l.f1()) should ===(SourceFileLines("LineNumberSpecCodeForJava.java", 29, 29))
}
"work for larger functions" in {
// because how java Lambdas are implemented/designed
- LineNumbers(l.f2()) should ===(SourceFileLines("LineNumberSpecCodeForJava.java", 25, 26))
+ LineNumbers(l.f2()) should ===(SourceFileLines("LineNumberSpecCodeForJava.java", 34, 35))
}
"work for anonymous classes" in {
- LineNumbers(l.f3()) should ===(SourceFileLines("LineNumberSpecCodeForJava.java", 31, 36))
+ LineNumbers(l.f3()) should ===(SourceFileLines("LineNumberSpecCodeForJava.java", 40, 45))
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pekko.apache.org
For additional commands, e-mail: commits-help@pekko.apache.org