Skip to content

Commit

Permalink
Merge pull request #213 from RDPerera/2201.8.x
Browse files Browse the repository at this point in the history
Migrate std:regex to lang.regexp
  • Loading branch information
RDPerera authored Mar 22, 2024
2 parents 6c968e1 + d5fd26c commit 1fe04ef
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 38 deletions.
33 changes: 0 additions & 33 deletions ballerina/Dependencies.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,25 +33,6 @@ dependencies = [
{org = "ballerina", name = "jballerina.java"}
]

[[package]]
org = "ballerina"
name = "lang.regexp"
version = "0.0.0"
scope = "testOnly"
dependencies = [
{org = "ballerina", name = "jballerina.java"}
]

[[package]]
org = "ballerina"
name = "lang.string"
version = "0.0.0"
scope = "testOnly"
dependencies = [
{org = "ballerina", name = "jballerina.java"},
{org = "ballerina", name = "lang.regexp"}
]

[[package]]
org = "ballerina"
name = "lang.value"
Expand Down Expand Up @@ -95,19 +76,6 @@ modules = [
{org = "ballerina", packageName = "os", moduleName = "os"}
]

[[package]]
org = "ballerina"
name = "regex"
version = "1.3.2"
scope = "testOnly"
dependencies = [
{org = "ballerina", name = "jballerina.java"},
{org = "ballerina", name = "lang.string"}
]
modules = [
{org = "ballerina", packageName = "regex", moduleName = "regex"}
]

[[package]]
org = "ballerina"
name = "test"
Expand Down Expand Up @@ -152,7 +120,6 @@ dependencies = [
{org = "ballerina", name = "jballerina.java"},
{org = "ballerina", name = "log"},
{org = "ballerina", name = "os"},
{org = "ballerina", name = "regex"},
{org = "ballerina", name = "test"},
{org = "ballerina", name = "time"},
{org = "ballerinai", name = "observe"}
Expand Down
9 changes: 4 additions & 5 deletions ballerina/tests/asb_sender_receiver_negative_tests.bal
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,7 @@

import ballerina/log;
import ballerina/test;
import ballerina/regex;

string invalidCompleteError = "^Failed to complete message with ID:.*$";
string invalidAbandonError = "^Failed to abandon message with ID:.*$";
@test:Config {
groups: ["asb_sender_receiver_negative"],
dependsOn: [testCreateQueue, testCreateTopicOperation, testCreateSubscription]
Expand Down Expand Up @@ -76,7 +73,8 @@ function testInvalidComplete() returns error? {
log:printInfo("messgae" + receivedMessage.toString());
Error? result = messageReceiver->complete(receivedMessage);
test:assertTrue(result is error, msg = "Unexpected Complete for Messages in Receive and Delete Mode");
test:assertTrue(regex:matches((<Error>result).message(),invalidCompleteError), msg = "Invalid Complete for " +
string:RegExp completeFailedMsg = re `^Failed to complete message with ID:.*$`;
test:assertTrue(completeFailedMsg.isFullMatch((<Error>result).message()), msg = "Invalid Complete for " +
" Messages in Receive and Delete Mode");
} else if receivedMessage is () {
test:assertFail("No message in the queue.");
Expand Down Expand Up @@ -116,7 +114,8 @@ function testInvalidAbandon() returns error? {
log:printInfo("messgae" + receivedMessage.toString());
Error? result = messageReceiver->abandon(receivedMessage);
test:assertTrue(result is error, msg = "Unexpected Abandon for Messages in Receive and Delete Mode");
test:assertTrue(regex:matches((<Error>result).message(),invalidAbandonError), msg = "Invalid Abandon for " +
string:RegExp abandonFailedMsg = re `^Failed to abandon message with ID:.*$`;
test:assertTrue(abandonFailedMsg.isFullMatch((<Error>result).message()), msg = "Invalid Abandon for " +
" Messages in Receive and Delete Mode");
} else if receivedMessage is () {
test:assertFail("No message in the queue.");
Expand Down

0 comments on commit 1fe04ef

Please sign in to comment.