Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/primitiveLiteral.ts
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ export namespace PrimitiveLiteral {
index++;
let dayNext = Utils.required(value, index, Lexer.DIGIT, 1);
if (dayNext === index && value[index + 1] !== 0x54) return;
index = dayNext;
if (dayNext != 0) index = dayNext;
if (value[index] === 0x44) index++;
let end = index;
if (value[index] === 0x54) {
Expand Down
80 changes: 80 additions & 0 deletions test/primitive-cases.json
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,86 @@
"value": "Edm.Duration"
}
},
{
"-Name": "Duration 0 days",
"-Rule": "duration",
"Input": "duration'P0D'",
"result": {
"position": 0,
"type": "Literal",
"value": "Edm.Duration"
}
},
{
"-Name": "Duration 2-digit days",
"-Rule": "duration",
"Input": "duration'P10D'",
"result": {
"position": 0,
"type": "Literal",
"value": "Edm.Duration"
}
},
{
"-Name": "Duration days and hours",
"-Rule": "duration",
"Input": "duration'P10DT23H'",
"result": {
"position": 0,
"type": "Literal",
"value": "Edm.Duration"
}
},
{
"-Name": "Duration 0 days and 2 hours",
"-Rule": "duration",
"Input": "duration'P0DT2H'",
"result": {
"position": 0,
"type": "Literal",
"value": "Edm.Duration"
}
},
{
"-Name": "Duration hours no day component",
"-Rule": "duration",
"Input": "duration'PT2H'",
"result": {
"position": 0,
"type": "Literal",
"value": "Edm.Duration"
}
},
{
"-Name": "Duration minutes no day component",
"-Rule": "duration",
"Input": "duration'PT30M'",
"result": {
"position": 0,
"type": "Literal",
"value": "Edm.Duration"
}
},
{
"-Name": "Duration seconds no day component",
"-Rule": "duration",
"Input": "duration'PT5S'",
"result": {
"position": 0,
"type": "Literal",
"value": "Edm.Duration"
}
},
{
"-Name": "Duration seconds missing T",
"-Rule": "duration",
"Input": "duration'P5S'",
"result_error": {
"position": 0,
"type": "Literal",
"value": "Edm.Duration"
}
},
{
"-Name": "Decimal: integer",
"-Rule": "decimalValue",
Expand Down