Skip to content

Commit

Permalink
filter out js keywords and azle keyword
Browse files Browse the repository at this point in the history
  • Loading branch information
bdemann committed Dec 6, 2023
1 parent 6a9ba40 commit bb245ad
Showing 1 changed file with 32 additions and 1 deletion.
33 changes: 32 additions & 1 deletion property_tests/arbitraries/js_function_name_arb.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,37 @@ const rustKeywords = [
'yield'
];

const azleKeywords = [
'blob',
'bool',
'float32',
'float64',
'Func',
'int',
'int8',
'int16',
'int32',
'int64',
'nat',
'nat8',
'nat16',
'nat32',
'nat64',
'Null',
'Opt',
'Principal',
'Record',
'Recursive',
'Service',
'Tuple',
'Variant',
'Vec'
];

const jsKeywords = ['eval', 'var', 'new'];

export const JsFunctionNameArb = fc
.stringMatching(/^(_[a-zA-Z0-9]+|[a-zA-Z][a-zA-Z0-9]*)$/)
.filter((sample) => !rustKeywords.includes(sample));
.filter((sample) => !rustKeywords.includes(sample))
.filter((sample) => !jsKeywords.includes(sample))
.filter((sample) => !azleKeywords.includes(sample));

0 comments on commit bb245ad

Please sign in to comment.