Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
linphone-desktop
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
linphone-desktop
Commits
51b629c4
Commit
51b629c4
authored
Nov 09, 2016
by
Ronan Abhamon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat(Utils/uri-tools): add spec file to test uris
parent
50d190a2
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
107 additions
and
22 deletions
+107
-22
test_qml
tests/tools/test_qml
+11
-21
uri-tools.js
tests/ui/scripts/Utils/uri-tools.js
+1
-1
uri-tools.spec.qml
tests/ui/scripts/Utils/uri-tools.spec.qml
+95
-0
No files found.
tests/tools/test_qml
View file @
51b629c4
...
...
@@ -20,38 +20,28 @@ NC='\e[0m'
SCRIPT_DIR
=
"
$(
cd
"
$(
dirname
"
${
BASH_SOURCE
[0]
}
"
)
"
&&
pwd
)
"
cd
$SCRIPT_DIR
/..
# Check JS lib.
printf
"
${
BLUE
}
Testing scripts lib...
${
NC
}
\n
"
# ====================================================================
so_far_so_good
=
0
$TEST_RUNNER
-import
$MODULES_PATH
-input
'./ui/scripts/Utils/utils.spec.qml'
if
[[
$?
==
0
]]
;
then
printf
"
${
GREEN
}
Done. No error found in scripts lib.
\n
"
else
printf
"
${
RED
}
One or more errors were found. Please to fix them.
\n
"
so_far_so_good
=
1
fi
printf
"
${
NC
}
\n
"
# Check all `*.spec.qml` files
# Check all `*.spec.qml` files
.
while
read
line
do
qml
_file
=
$(
source
_file
=
$(
printf
"
$line
"
|
sed
-n
's/^\s*<\s*file\s*>\s*\(.*\.
qml
\)\s*<\s*\/\s*file\s*>\s*$/\1/p'
sed
-n
's/^\s*<\s*file\s*>\s*\(.*\.
\(qml\|js\)
\)\s*<\s*\/\s*file\s*>\s*$/\1/p'
)
if
[[
!
-z
$
qml
_file
]]
;
then
spec_
qml_file
=
"
${
qml
_file
%.*
}
.
${
TEST_FILE_EXTENSION
}
"
if
[[
!
-z
$
source
_file
]]
;
then
spec_
file
=
"
${
source
_file
%.*
}
.
${
TEST_FILE_EXTENSION
}
"
if
[
-f
$spec_
qml_
file
]
;
then
printf
"
${
BLUE
}
Running unit qml tests of '
${
qml
_file
}
'...
${
NC
}
\n
"
$TEST_RUNNER
-import
$MODULES_PATH
-import
$SCRIPTS_PATH
-input
"
$spec_
qml_
file
"
if
[
-f
$spec_file
]
;
then
printf
"
${
BLUE
}
Running unit qml tests of '
${
source
_file
}
'...
${
NC
}
\n
"
$TEST_RUNNER
-import
$MODULES_PATH
-import
$SCRIPTS_PATH
-input
"
$spec_file
"
if
[[
$?
==
0
]]
;
then
printf
"
${
GREEN
}
All unit tests have succeeded for '
${
spec_
qml_
file
}
'.
\n
"
printf
"
${
GREEN
}
All unit tests have succeeded for '
${
spec_file
}
'.
\n
"
else
printf
"
${
RED
}
Unit tests have failed for '
${
spec_
qml_
file
}
'.
\n
"
printf
"
${
RED
}
Unit tests have failed for '
${
spec_file
}
'.
\n
"
so_far_so_good
=
1
fi
printf
"
${
NC
}
\n
"
...
...
tests/ui/scripts/Utils/uri-tools.js
View file @
51b629c4
...
...
@@ -13,7 +13,7 @@ var SUPPORTS_URL = true
// Level 0. ----------------------------------------------------------
var
URI_PCT_ENCODED
=
'
%[A-Fa-f
\\
d]{2}
'
var
URI_PORT
=
'
\
d*
'
var
URI_PORT
=
'
\
\
d*
'
var
URI_SCHEME
=
'
[a-zA-Z][
\\
w+
\
-
\
.]*
'
var
URI_SUB_DELIMS
=
'
[!$&
\'
()*+,;=]
'
var
URI_UNRESERVED
=
'
[
\\
w
\
-
\
._~]
'
...
...
tests/ui/scripts/Utils/uri-tools.spec.qml
0 → 100644
View file @
51b629c4
import
QtTest
1.1
import
'
./uri-tools.js
'
as
UriTools
// ===================================================================
TestCase
{
function
test_regexExists
()
{
compare
(
UriTools
.
URI_REGEX
instanceof
RegExp
,
true
,
'
`URI_REGEX` is not a `RegExp` or is undefined.
'
)
}
function
test_urlSupport
()
{
compare
(
typeof
UriTools
.
SUPPORTS_URL
,
'
boolean
'
,
'
`SUPPORTS_URL` is not a `Boolean` or is undefined.
'
)
}
function
test_matchUri_data
()
{
return
[
{
input
:
'
http://www.LaRmInA.com/
'
,
output
:
[
'
http://www.LaRmInA.com/
'
]
},
{
input
:
'
http://foob%3Dbar@baz.fr
'
,
output
:
[
'
http://foob%3Dbar@baz.fr
'
]
},
{
input
:
'
file://a/b/c/;d
'
,
output
:
[
'
file://a/b/c/;d
'
]
},
{
input
:
'
ftp://0/
'
,
output
:
[
'
ftp://0/
'
]
},
{
input
:
'
mailto://valentin.cognito@domain.unknown
'
,
output
:
[
'
mailto://valentin.cognito@domain.unknown
'
]
},
{
input
:
'
mailto://sLimAne@egypt
'
,
output
:
[
'
mailto://sLimAne@egypt
'
]
},
{
input
:
'
file://beetlejuice-beetlejuice-beetlejui...
'
,
output
:
[
'
file://beetlejuice-beetlejuice-beetlejui...
'
]
},
{
input
:
'
https://gitlab@localhost
'
,
output
:
[
'
https://gitlab@localhost
'
]
},
{
input
:
'
xmpp:von.zimmel@reich.org
'
,
output
:
[
'
xmpp:von.zimmel@reich.org
'
]
},
{
input
:
'
dot.dot://dot.dot.dot@dot.dot.dot
'
,
output
:
[
'
dot.dot://dot.dot.dot@dot.dot.dot
'
]
},
{
input
:
'
A:B
'
,
output
:
[
'
A:B
'
]
},
{
input
:
'
foo://a=B.7z*+9aZb;$.!,!,!_(~_~)_-&
\'
:
'
,
output
:
[
'
foo://a=B.7z*+9aZb;$.!,!,!_(~_~)_-&
\'
:
'
]
},
{
input
:
'
foo+bar+baz://hey:1800/it-s-me?a&b=12
'
,
output
:
[
'
foo+bar+baz://hey:1800/it-s-me?a&b=12
'
]
},
{
input
:
'
nsa://localhost:666
'
,
output
:
[
'
nsa://localhost:666
'
]
},
{
input
:
'
protocol://U$3r:p@sswd/WwW.L33t.sp3
'
,
output
:
[
'
protocol://U$3r:p@sswd/WwW.L33t.sp3
'
]
},
{
input
:
'
http://a/B/c?a&b&c
'
,
output
:
[
'
http://a/B/c?a&b&c
'
]
},
{
input
:
'
1http://www.linphone.org
'
,
output
:
[
'
http://www.linphone.org
'
]
},
{
input
:
'
://www.linphone.org
'
,
output
:
UriTools
.
SUPPORTS_URL
?
[
'
www.linphone.org
'
]
:
null
},
{
input
:
'
http
'
,
output
:
null
},
{
input
:
'
/path/
'
,
output
:
null
}
]
}
function
test_matchUri
(
data
)
{
compare
(
data
.
input
.
match
(
UriTools
.
URI_REGEX
),
data
.
output
)
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment