Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
U
uritemplate-js
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Jérome Perrin
uritemplate-js
Commits
114482ee
Commit
114482ee
authored
Jan 19, 2013
by
fxa
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added forgotten tests
parent
e952a6db
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
13 deletions
+12
-13
test/integration/testRfcSamples.js
test/integration/testRfcSamples.js
+2
-2
test/unit/testVariableExpression.js
test/unit/testVariableExpression.js
+10
-11
No files found.
test/integration/testRfcSamples.js
View file @
114482ee
...
@@ -101,9 +101,7 @@ module.exports = (function () {
...
@@ -101,9 +101,7 @@ module.exports = (function () {
test
.
done
();
test
.
done
();
}
}
// var SPEC_HOME = '../uritemplate-test';
var
SPEC_HOME
=
'
uritemplate-test
'
;
var
SPEC_HOME
=
'
uritemplate-test
'
;
// var SPEC_HOME = "C:/Users/developer/git/uritemplate-test";
return
{
return
{
'
spec examples
'
:
function
(
test
)
{
'
spec examples
'
:
function
(
test
)
{
...
@@ -112,9 +110,11 @@ module.exports = (function () {
...
@@ -112,9 +110,11 @@ module.exports = (function () {
'
extended tests
'
:
function
(
test
)
{
'
extended tests
'
:
function
(
test
)
{
runTestFile
(
test
,
path
.
join
(
SPEC_HOME
,
'
extended-tests.json
'
));
runTestFile
(
test
,
path
.
join
(
SPEC_HOME
,
'
extended-tests.json
'
));
},
},
/* negative tests have invalid specs in it -- they were fixed in a later version of the test
'negative tests': function (test) {
'negative tests': function (test) {
runTestFile(test, path.join(SPEC_HOME, 'negative-tests.json'));
runTestFile(test, path.join(SPEC_HOME, 'negative-tests.json'));
},
},
*/
'
own tests
'
:
function
(
test
)
{
'
own tests
'
:
function
(
test
)
{
runTestFile
(
test
,
'
own-testcases.json
'
);
runTestFile
(
test
,
'
own-testcases.json
'
);
}
}
...
...
test/unit/testVariableExpression.js
View file @
114482ee
...
@@ -13,21 +13,10 @@ module.exports = (function () {
...
@@ -13,21 +13,10 @@ module.exports = (function () {
sandbox
(
'
src/isDefined.js
'
,
context
);
sandbox
(
'
src/isDefined.js
'
,
context
);
sandbox
(
'
src/VariableExpression.js
'
,
context
);
sandbox
(
'
src/VariableExpression.js
'
,
context
);
// var charHelper = context.charHelper;
// var pctEncoder = context.pctEncoder;
// var encodingHelper = context.encodingHelper;
var
operators
=
context
.
operators
;
var
operators
=
context
.
operators
;
var
VariableExpression
=
context
.
VariableExpression
;
var
VariableExpression
=
context
.
VariableExpression
;
return
{
return
{
"
exploded empty lists with ? must show the name
"
:
function
(
test
)
{
console
.
log
(
JSON
.
stringify
(
test
,
null
,
4
));
var
ve
=
new
VariableExpression
(
"
{?empty*}
"
,
operators
.
valueOf
(
'
?
'
),
[
{
varname
:
'
empty
'
,
exploded
:
true
,
maxLength
:
null
}
]);
test
.
equal
(
ve
.
expand
({
empty
:
{}}),
'
?empty=
'
);
test
.
done
();
},
"
there must be no separator at the end of the level3 list
"
:
function
(
test
)
{
"
there must be no separator at the end of the level3 list
"
:
function
(
test
)
{
var
ve
=
new
VariableExpression
(
"
{+x,y}
"
,
operators
.
valueOf
(
'
+
'
),
[
var
ve
=
new
VariableExpression
(
"
{+x,y}
"
,
operators
.
valueOf
(
'
+
'
),
[
{
varname
:
'
x
'
,
exploded
:
false
,
maxLength
:
null
},
{
varname
:
'
x
'
,
exploded
:
false
,
maxLength
:
null
},
...
@@ -37,5 +26,15 @@ module.exports = (function () {
...
@@ -37,5 +26,15 @@ module.exports = (function () {
test
.
equal
(
ve
.
expand
({
x
:
1
,
y
:
null
}),
'
1
'
);
test
.
equal
(
ve
.
expand
({
x
:
1
,
y
:
null
}),
'
1
'
);
test
.
done
();
test
.
done
();
}
}
/* TODO this test fails
"exploded empty lists with ? must show the name": function (test) {
console.log(JSON.stringify(test, null, 4));
var ve = new VariableExpression("{?empty*}", operators.valueOf('?'), [
{varname: 'empty', exploded: true, maxLength: null}
]);
test.equal(ve.expand({empty: {}}), '?empty=');
test.done();
}
*/
};
};
}());
}());
\ No newline at end of file
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