-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Removed _formatTag from ParsedHedTag as this is handled in tokenizer
- Loading branch information
Showing
6 changed files
with
206 additions
and
86 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,120 @@ | ||
import { generateIssue } from '../../common/issues/issues' | ||
import { ColumnSpliceSpec, GroupSpec, TagSpec } from '../../parser/tokenizer' | ||
|
||
export const parsedHedTagTests = [ | ||
{ | ||
name: 'valid-tags', | ||
description: 'Valid tags with extensions', | ||
warning: false, | ||
tests: [ | ||
{ | ||
testname: 'valid-tag-one-level', | ||
explanation: '"Item" is a top-level-tag.', | ||
schemaVersion: '8.3.0', | ||
fullString: 'Item', | ||
tagSpec: new TagSpec('Item', 0, 4, ''), | ||
tagLong: 'Item', | ||
tagShort: 'Item', | ||
formattedTag: 'item', | ||
canonicalTag: 'Item', | ||
error: null, | ||
}, | ||
{ | ||
testname: 'valid-tag-with-blanks', | ||
explanation: '" Item " has surrounding blanks.', | ||
schemaVersion: '8.3.0', | ||
fullString: ' Item ', | ||
tagSpec: new TagSpec('Item', 1, 5, ''), | ||
tagLong: 'Item', | ||
tagShort: 'Item', | ||
formattedTag: 'item', | ||
canonicalTag: 'Item', | ||
takesValue: false, | ||
error: null, | ||
}, | ||
{ | ||
testname: 'valid-Two-level-tag', | ||
explanation: '" Item/object " is two-level and mixed case.', | ||
schemaVersion: '8.3.0', | ||
fullString: ' Item/object ', | ||
tagSpec: new TagSpec('Item/object', 1, 12, ''), | ||
tagLong: 'Item/Object', | ||
tagShort: 'Object', | ||
formattedTag: 'item/object', | ||
canonicalTag: 'Item/Object', | ||
takesValue: false, | ||
error: null, | ||
}, | ||
{ | ||
testname: 'valid-tag-with-extension', | ||
explanation: '" Object/blech " is two-level and mixed case.', | ||
schemaVersion: '8.3.0', | ||
fullString: ' Object/blech ', | ||
tagSpec: new TagSpec('object/Blech', 1, 13, ''), | ||
tagLong: 'Item/Object/Blech', | ||
tagShort: 'Object/Blech', | ||
formattedTag: 'item/object/blech', | ||
canonicalTag: 'Item/Object/Blech', | ||
takesValue: false, | ||
error: null, | ||
}, | ||
{ | ||
testname: 'valid-tag-with-value-no-units', | ||
explanation: '" Age/5 " has a value but no units.', | ||
schemaVersion: '8.3.0', | ||
fullString: ' Age/5 ', | ||
tagSpec: new TagSpec(' Age/5 ', 1, 6, ''), | ||
tagLong: 'Property/Agent-property/Agent-trait/Age/5', | ||
tagShort: 'Age/5', | ||
formattedTag: 'property/agent-property/agent-trait/age/5', | ||
canonicalTag: 'Property/Agent-property/Agent-trait/Age/5', | ||
takesValue: true, | ||
error: null, | ||
}, | ||
{ | ||
testname: 'valid-tag-with-value-and-units', | ||
explanation: '" Length/3 m " has a value and valid units.', | ||
schemaVersion: '8.3.0', | ||
fullString: ' Length/3 m ', | ||
tagSpec: new TagSpec(' Length/3 m ', 1, 11, ''), | ||
tagLong: 'Property/Data-property/Data-value/Spatiotemporal-value/Spatial-value/Size/Length/3 m', | ||
tagShort: 'Length/3 m', | ||
formattedTag: 'property/data-property/data-value/spatiotemporal-value/spatial-value/size/length/3 m', | ||
canonicalTag: 'Property/Data-property/Data-value/Spatiotemporal-value/Spatial-value/Size/Length/3 m', | ||
takesValue: true, | ||
error: null, | ||
}, | ||
], | ||
}, | ||
{ | ||
name: 'invalid-tags', | ||
description: 'Various invalid tags', | ||
warning: false, | ||
tests: [ | ||
{ | ||
testname: 'invalid-tag-requires-child', | ||
explanation: '"Duration" should have a child.', | ||
schemaVersion: '8.3.0', | ||
fullString: 'Duration', | ||
tagSpec: new TagSpec('Duration', 0, 8, ''), | ||
tagLong: undefined, | ||
tagShort: undefined, | ||
formattedTag: undefined, | ||
canonicalTag: undefined, | ||
error: generateIssue('childRequired', { tag: 'Duration' }), | ||
}, | ||
{ | ||
testname: 'invalid-tag-should-not-have-a-placeholder', | ||
explanation: '"object/#" should not have a placeholder.', | ||
schemaVersion: '8.3.0', | ||
fullString: 'object/#', | ||
tagSpec: new TagSpec('object/#', 0, 8, ''), | ||
tagLong: undefined, | ||
tagShort: undefined, | ||
formattedTag: undefined, | ||
canonicalTag: undefined, | ||
error: null, | ||
}, | ||
], | ||
}, | ||
] |