From 62c748936c42451d4a17c5321d804111203a9e4f Mon Sep 17 00:00:00 2001 From: AndreyL ProductEngine Date: Wed, 15 Jul 2015 23:58:56 +0300 Subject: MAINT-5019: Buildfix - added a tests for emails, improved handling of URLs starting with www. --- indra/llui/tests/llurlentry_test.cpp | 76 ++++++++++++++++++++++++++---------- 1 file changed, 55 insertions(+), 21 deletions(-) (limited to 'indra/llui/tests') diff --git a/indra/llui/tests/llurlentry_test.cpp b/indra/llui/tests/llurlentry_test.cpp index 15f2354552..a4ab6943b8 100755 --- a/indra/llui/tests/llurlentry_test.cpp +++ b/indra/llui/tests/llurlentry_test.cpp @@ -653,45 +653,45 @@ namespace tut void object::test<11>() { // - // test LLUrlEntryHTTPNoProtocol - general URLs without a protocol + // test LLUrlEntryHTTPNoProtocol - general URLs without a protocol, starting with "www." prefix (MAINT-5019) // LLUrlEntryHTTPNoProtocol url; testRegex("naked .com URL", url, "see google.com", - "http://google.com"); + ""); testRegex("naked .org URL", url, "see en.wikipedia.org for details", - "http://en.wikipedia.org"); + ""); testRegex("naked .net URL", url, "example.net", - "http://example.net"); + ""); - testRegex("naked .edu URL (2 instances)", url, + testRegex("naked .edu URL (2 instances), .www prefix", url, "MIT web site is at web.mit.edu and also www.mit.edu", - "http://web.mit.edu"); + "http://www.mit.edu"); testRegex("don't match e-mail addresses", url, "test@lindenlab.com", ""); - testRegex(".com URL with path", url, - "see secondlife.com/status for grid status", - "http://secondlife.com/status"); + testRegex("www.test.com URL with path", url, + "see www.test.com/status for grid status", + "http://www.test.com/status"); - testRegex(".com URL with port", url, - "secondlife.com:80", - "http://secondlife.com:80"); + testRegex("www.test.com URL with port", url, + "www.test.com:80", + "http://www.test.com:80"); - testRegex(".com URL with port and path", url, - "see secondlife.com:80/status", - "http://secondlife.com:80/status"); + testRegex("www.test.com URL with port and path", url, + "see www.test.com:80/status", + "http://www.test.com:80/status"); testRegex("www.*.com URL with port and path", url, - "see www.secondlife.com:80/status", - "http://www.secondlife.com:80/status"); + "see www.test.com:80/status", + "http://www.test.com:80/status"); testRegex("invalid .com URL [1]", url, "..com", @@ -714,12 +714,12 @@ namespace tut ""); testRegex("XML tags around URL [1]", url, - "secondlife.com", - "http://secondlife.com"); + "www.test.com", + "http://www.test.com"); testRegex("XML tags around URL [2]", url, - "secondlife.com/status?bar=1", - "http://secondlife.com/status?bar=1"); + "www.test.com/status?bar=1", + "http://www.test.com/status?bar=1"); } template<> template<> @@ -860,4 +860,38 @@ namespace tut "secondlife:///app/region/Product%20Engine", "Product Engine"); } + + template<> template<> + void object::test<14>() + { + // + // test LLUrlEntryemail - general emails + // + LLUrlEntryEmail url; + + // Regex tests. + testRegex("match e-mail addresses", url, + "test@lindenlab.com", + "mailto:test@lindenlab.com"); + + testRegex("match e-mail addresses with mailto: prefix", url, + "mailto:test@lindenlab.com", + "mailto:test@lindenlab.com"); + + testRegex("match e-mail addresses with different domains", url, + "test@foo.org.us", + "mailto:test@foo.org.us"); + + testRegex("match e-mail addresses with different domains", url, + "test@foo.bar", + "mailto:test@foo.bar"); + + testRegex("don't match incorrect e-mail addresses", url, + "test @foo.com", + ""); + + testRegex("don't match incorrect e-mail addresses", url, + "test@ foo.com", + ""); + } } -- cgit v1.2.3 From e62d5ea4e822e7bb2204eca25c8c4a87a9f6b4be Mon Sep 17 00:00:00 2001 From: AndreyL ProductEngine Date: Wed, 29 Jul 2015 07:35:08 +0300 Subject: MAINT-5019 FIXED Undesired "http://" added to domains sent in chat Completely removed matching of the URLs w/o a protocol + Some unit tests --- indra/llui/tests/llurlentry_test.cpp | 140 ++++++++++++++++------------------- 1 file changed, 65 insertions(+), 75 deletions(-) (limited to 'indra/llui/tests') diff --git a/indra/llui/tests/llurlentry_test.cpp b/indra/llui/tests/llurlentry_test.cpp index a4ab6943b8..96e94c0f80 100755 --- a/indra/llui/tests/llurlentry_test.cpp +++ b/indra/llui/tests/llurlentry_test.cpp @@ -651,79 +651,6 @@ namespace tut template<> template<> void object::test<11>() - { - // - // test LLUrlEntryHTTPNoProtocol - general URLs without a protocol, starting with "www." prefix (MAINT-5019) - // - LLUrlEntryHTTPNoProtocol url; - - testRegex("naked .com URL", url, - "see google.com", - ""); - - testRegex("naked .org URL", url, - "see en.wikipedia.org for details", - ""); - - testRegex("naked .net URL", url, - "example.net", - ""); - - testRegex("naked .edu URL (2 instances), .www prefix", url, - "MIT web site is at web.mit.edu and also www.mit.edu", - "http://www.mit.edu"); - - testRegex("don't match e-mail addresses", url, - "test@lindenlab.com", - ""); - - testRegex("www.test.com URL with path", url, - "see www.test.com/status for grid status", - "http://www.test.com/status"); - - testRegex("www.test.com URL with port", url, - "www.test.com:80", - "http://www.test.com:80"); - - testRegex("www.test.com URL with port and path", url, - "see www.test.com:80/status", - "http://www.test.com:80/status"); - - testRegex("www.*.com URL with port and path", url, - "see www.test.com:80/status", - "http://www.test.com:80/status"); - - testRegex("invalid .com URL [1]", url, - "..com", - ""); - - testRegex("invalid .com URL [2]", url, - "you.come", - ""); - - testRegex("invalid .com URL [3]", url, - "recommended", - ""); - - testRegex("invalid .edu URL", url, - "hi there scheduled maitenance has begun", - ""); - - testRegex("invalid .net URL", url, - "foo.netty", - ""); - - testRegex("XML tags around URL [1]", url, - "www.test.com", - "http://www.test.com"); - - testRegex("XML tags around URL [2]", url, - "www.test.com/status?bar=1", - "http://www.test.com/status?bar=1"); - } - - template<> template<> - void object::test<12>() { // // test LLUrlEntryNoLink - turn off hyperlinking @@ -752,7 +679,7 @@ namespace tut } template<> template<> - void object::test<13>() + void object::test<12>() { // // test LLUrlEntryRegion - secondlife:///app/region/ URLs @@ -862,7 +789,7 @@ namespace tut } template<> template<> - void object::test<14>() + void object::test<13>() { // // test LLUrlEntryemail - general emails @@ -894,4 +821,67 @@ namespace tut "test@ foo.com", ""); } + + template<> template<> + void object::test<14>() + { + // + // test LLUrlEntrySimpleSecondlifeURL - http://*.secondlife.com/* and http://*lindenlab.com/* urls + // + LLUrlEntrySecondlifeURL url; + + testRegex("match urls with protocol", url, + "this url should match http://lindenlab.com/products/second-life", + "http://lindenlab.com/products/second-life"); + + testRegex("match urls with protocol", url, + "search something https://marketplace.secondlife.com/products/search on marketplace and test the https", + "https://marketplace.secondlife.com/products/search"); + + testRegex("match urls with port", url, + "let's specify some port http://secondlife.com:888/status", + "http://secondlife.com:888/status"); + + testRegex("don't match urls w/o protocol", url, + "looks like an url something www.marketplace.secondlife.com/products but no https prefix", + ""); + + testRegex("but with a protocol www is fine", url, + "so let's add a protocol http://www.marketplace.secondlife.com:8888/products", + "http://www.marketplace.secondlife.com:8888/products"); + + testRegex("don't match urls w/o protocol", url, + "and even no www something secondlife.com/status", + ""); + } + + template<> template<> + void object::test<15>() + { + // + // test LLUrlEntrySimpleSecondlifeURL - http://*.secondlife.com and http://*lindenlab.com urls + // + + LLUrlEntrySimpleSecondlifeURL url; + + testRegex("match urls with a protocol", url, + "this url should match http://lindenlab.com", + "http://lindenlab.com"); + + testRegex("match urls with a protocol", url, + "search something https://marketplace.secondlife.com on marketplace and test the https", + "https://marketplace.secondlife.com"); + + testRegex("don't match urls w/o protocol", url, + "looks like an url something www.marketplace.secondlife.com but no https prefix", + ""); + + testRegex("but with a protocol www is fine", url, + "so let's add a protocol http://www.marketplace.secondlife.com", + "http://www.marketplace.secondlife.com"); + + testRegex("don't match urls w/o protocol", url, + "and even no www something lindenlab.com", + ""); + } } -- cgit v1.2.3 From 52d30bbbe94b93da6d56633bff0f6d40fa135ded Mon Sep 17 00:00:00 2001 From: AndreyL ProductEngine Date: Fri, 23 Oct 2015 07:52:43 +0300 Subject: MAINT-5464 FIXED Do not add badge to links that have a port number specified. --- indra/llui/tests/llurlentry_test.cpp | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'indra/llui/tests') diff --git a/indra/llui/tests/llurlentry_test.cpp b/indra/llui/tests/llurlentry_test.cpp index 96e94c0f80..dde54c78c4 100755 --- a/indra/llui/tests/llurlentry_test.cpp +++ b/indra/llui/tests/llurlentry_test.cpp @@ -838,17 +838,21 @@ namespace tut "search something https://marketplace.secondlife.com/products/search on marketplace and test the https", "https://marketplace.secondlife.com/products/search"); - testRegex("match urls with port", url, - "let's specify some port http://secondlife.com:888/status", - "http://secondlife.com:888/status"); + testRegex("match HTTPS urls with port", url, + "let's specify some port https://secondlife.com:888/status", + "https://secondlife.com:888/status"); + + testRegex("don't match HTTP urls with port", url, + "let's specify some port for HTTP http://secondlife.com:888/status", + ""); testRegex("don't match urls w/o protocol", url, "looks like an url something www.marketplace.secondlife.com/products but no https prefix", ""); testRegex("but with a protocol www is fine", url, - "so let's add a protocol http://www.marketplace.secondlife.com:8888/products", - "http://www.marketplace.secondlife.com:8888/products"); + "so let's add a protocol https://www.marketplace.secondlife.com:8888/products", + "https://www.marketplace.secondlife.com:8888/products"); testRegex("don't match urls w/o protocol", url, "and even no www something secondlife.com/status", -- cgit v1.2.3