Skip to content

Commit

Permalink
update: adjust test to identity restart/continue
Browse files Browse the repository at this point in the history
  • Loading branch information
RafaelGSS authored and oguimbal committed Apr 28, 2021
1 parent 57ee794 commit 8aac827
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/syntax/delete.ne
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ delete_delete -> (kw_delete %kw_from)
});
} %}

delete_truncate -> (kw_truncate %kw_table:?) array_of[table_ref] (kw_restart kw_identity):? {% x => track(x, {
delete_truncate -> (kw_truncate %kw_table:?) array_of[table_ref] ((kw_restart | kw_continue) kw_identity):? {% x => track(x, {
type: 'truncate table',
tables: x[1],
...x[2] && { identity: toStr(x[2][0]) }
}) %}
11 changes: 10 additions & 1 deletion src/syntax/delete.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,24 @@ describe('Delete', () => {
type: 'truncate table',
tables: [{ name: 'test' }]
});

checkStatement([`truncate test restart identity`, `truncate table test restart identity`], {
type: 'truncate table',
tables: [{ name: 'test' }]
tables: [{ name: 'test' }],
identity: 'restart'
});

checkStatement([`truncate test continue identity`, `truncate table test continue identity`], {
type: 'truncate table',
tables: [{ name: 'test' }],
identity: 'continue'
});

checkStatement([`truncate ta, "tb"`, `truncate table "ta","tb"`], {
type: 'truncate table',
tables: [{ name: 'ta' }, { name: 'tb' }]
});

checkDelete([`delete from test`], {
type: 'delete',
from: { name: 'test' },
Expand Down

0 comments on commit 8aac827

Please sign in to comment.