-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
initial formatter schema #12
base: master
Are you sure you want to change the base?
Changes from 1 commit
795b99c
a4d238e
4517414
16d7123
39b3605
cfe58ae
731cd27
5c61e26
7693f72
f2333d4
5a56353
f196456
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,22 +21,29 @@ export class UniversalDataDefinitionLanguageFormatter extends AbstractFormatter | |
close.surround(Formatting.noSpace()).prepend(Formatting.newLine({allowMore: true})).append(Formatting.newLine({allowMore: true})); | ||
} | ||
|
||
protected formatNode(node: AstNode): void { | ||
const formatter = this.getNodeFormatter(node); | ||
formatter.property('name').prepend(Formatting.newLine()).surround(Formatting.oneSpace({allowMore: true})) | ||
} | ||
|
||
protected format(node: AstNode): void { | ||
// This method is called for every AstNode in a document | ||
if (ast.isDataModel(node)) { | ||
this.formatDataModel(node); | ||
} | ||
if(ast.isConceptualAssociation(node)){ | ||
this.formatConceptualAssociation(node) | ||
} | ||
// test passes with this commetned check | ||
// if(ast.isConceptualAssociation(node)){ | ||
// this.formatConceptualAssociation(node) | ||
// } | ||
|
||
if(ast.isConceptualEntity(node)){ | ||
this.formatConceptualEntity(node) | ||
} | ||
|
||
if(ast.isConceptualBasisEntity(node)){ | ||
this.formatConceptualBasisEntity(node) | ||
} | ||
|
||
// test passes with this commetned check | ||
// if(ast.isConceptualBasisEntity(node)){ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The test you have defined only has 1 ConceptualBasisEntity. The formatting you see around it is caused by 2 things: 1) the surrounding formatting is done by if you want to make sure you know the effect of a formatting method, you should have multiple instances of that type in your test. In this case, it means including multiple ConceptualBasisEntity instances. At a minimum, have 3. It may also make sense to have instances of different types intermingled where possible just to check on the effect of formatting one type on adjacent instances of a different type. This brings up an important point: You can't just have Instead, you need to make sure to use |
||
// this.formatConceptualBasisEntity(node) | ||
// } | ||
} | ||
|
||
|
||
|
@@ -102,9 +109,8 @@ export class UniversalDataDefinitionLanguageFormatter extends AbstractFormatter | |
} | ||
|
||
protected formatConceptualBasisEntity(basis: ast.ConceptualBasisEntity): void { | ||
const formatter = this.getNodeFormatter(basis); | ||
formatter.property('name').prepend(Formatting.newLine()).surround(Formatting.oneSpace({allowMore: true})); | ||
} | ||
this.formatNode(basis) | ||
} | ||
|
||
protected formatConceptualAssociation(cassoc: ast.ConceptualAssociation): void { | ||
this.formatContainer(cassoc) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The test you have defined does not include a ConceptualAssociation, so commenting this method out will have no effect on test success/ failure.