You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@pekko.apache.org by "He-Pin (via GitHub)" <gi...@apache.org> on 2023/08/16 08:30:09 UTC

[GitHub] [incubator-pekko] He-Pin commented on a diff in pull request #575: update ActorSystemSpec to use property based testing for its name

He-Pin commented on code in PR #575:
URL: https://github.com/apache/incubator-pekko/pull/575#discussion_r1295559748


##########
actor-tests/src/test/scala/org/apache/pekko/actor/ActorSystemSpec.scala:
##########
@@ -125,23 +123,17 @@ object ActorSystemSpec {
 }
 
 @nowarn
-class ActorSystemSpec extends PekkoSpec(ActorSystemSpec.config) with ImplicitSender {
+class ActorSystemSpec extends PekkoSpec(ActorSystemSpec.config) with ImplicitSender with ScalaCheckPropertyChecks {
 
   import ActorSystemSpec.FastActor
 
   "An ActorSystem" must {
 
     "reject invalid names" in {
-      for (n <- Seq(
-          "-hallowelt",
-          "_hallowelt",
-          "hallo*welt",
-          "hallo@welt",
-          "hallo#welt",
-          "hallo$welt",
-          "hallo%welt",
-          "hallo/welt")) intercept[IllegalArgumentException] {
-        ActorSystem(n)
+      forAll { (name: String) =>
+        whenever(!name.matches("""^[a-zA-Z0-9][a-zA-Z0-9-_]*$""")) {
+          intercept[IllegalArgumentException](ActorSystem(name))
+        }

Review Comment:
   Then there will be infinite cases to add



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org
For additional commands, e-mail: notifications-help@pekko.apache.org