Skip to content

Commit

Permalink
Merge pull request #786 from moufort/dev
Browse files Browse the repository at this point in the history
Refactoring all Microdown-Blog
  • Loading branch information
Ducasse authored Jul 2, 2024
2 parents 060e04d + c588ca2 commit 34ebfe6
Show file tree
Hide file tree
Showing 11 changed files with 376 additions and 305 deletions.
105 changes: 51 additions & 54 deletions src/BaselineOfMicrodown/BaselineOfMicrodown.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,25 @@ BaselineOfMicrodown >> baseline: spec [

<baseline>
spec for: #common do: [
self xmlParserHtml: spec.

self xmlParserHtml: spec.

spec
package: #Microdown;
package: #'Microdown-Tests'
with: [ spec requires: #( #Microdown ) ];
with: [ spec requires: #( #Microdown ) ];

package: #'Microdown-Pharo-Tools'
with: [ spec requires: #( #Microdown ) ];
with: [ spec requires: #( #Microdown ) ];

package: #'Microdown-RichTextComposer'
with: [ spec requires: #( #Microdown ) ];
with: [ spec requires: #( #Microdown ) ];
package: #'Microdown-RichTextComposer-Tests'
with: [ spec requires: #( #'Microdown-RichTextComposer' ) ];
with: [ spec requires: #( #'Microdown-RichTextComposer' ) ];

package: #'Microdown-MathFlaky-Tests'
with: [ spec requires: #( #'Microdown-RichTextComposer-Tests' ) ];
with: [ spec requires: #( #'Microdown-RichTextComposer-Tests' ) ];

"package: #'Microdown-RichTextPresenter'
with: [ spec requires: #( #Microdown ) ];
package: #'Microdown-RichTextPresenter-Tests'
Expand All @@ -37,70 +42,62 @@ BaselineOfMicrodown >> baseline: spec [
with: [ spec requires: #( #Microdown #'Microdown-RichTextPresenter') ];
package: #'Microdown-DocumentBrowser-Tests'
with: [ spec requires: #( #'Microdown-DocumentBrowser' ) ];"

package: #'Microdown-Transformer'
with: [ spec requires: #( #Microdown ) ];
with: [ spec requires: #( #Microdown ) ];
package: #'Microdown-Transformer-Tests'
with: [ spec requires: #( #'Microdown-Transformer' ) ];
with: [ spec requires: #( #'Microdown-Transformer' ) ];

package: #'Microdown-Evaluator'
with: [ spec requires: #( #'Microdown-Transformer' ) ];
with: [ spec requires: #( #'Microdown-Transformer' ) ];
package: #'Microdown-Evaluator-Tests'
with: [ spec requires: #( #'Microdown-Evaluator' ) ];
with: [ spec requires: #( #'Microdown-Evaluator') ];

package: #'Microdown-HTMLExporter'
with: [ spec requires: #( #Microdown #'Microdown-LaTeXExporter' ) ];
package: #'Microdown-HTMLExporter-Tests' with: [
spec requires:
#( #'Microdown-HTMLExporter' 'Microdown-Tests' 'XMLParserHTML' ) ];
with: [ spec requires: #( #Microdown #'Microdown-LaTeXExporter') ];
package: #'Microdown-HTMLExporter-Tests'
with: [ spec requires: #( #'Microdown-HTMLExporter' 'Microdown-Tests' 'XMLParserHTML') ];

package: #'Microdown-LaTeXExporter'
with: [ spec requires: #( #Microdown ) ];
package: #'Microdown-LaTeXExporter-Tests' with: [
spec requires: #( #'Microdown-LaTeXExporter'
#'Microdown-Tests' ) ];
with: [ spec requires: #( #Microdown ) ];
package: #'Microdown-LaTeXExporter-Tests'
with: [ spec requires: #( #'Microdown-LaTeXExporter' #'Microdown-Tests') ];

package: #'Microdown-BeamerExporter'
with: [ spec requires: #( #'Microdown-LaTeXExporter' ) ];
with: [ spec requires: #( #'Microdown-LaTeXExporter' ) ];
package: #'Microdown-BeamerExporter-Tests'
with: [ spec requires: #( #'Microdown-LaTeXExporter-Tests' ) ];
with: [ spec requires: #( #'Microdown-LaTeXExporter-Tests') ];

package: #'Microdown-PrettyPrinter'
with: [ spec requires: #( #Microdown ) ];
"package: #'Microdown-ReferenceChecker' with: [
spec requires: #( #'Microdown' ) ];"

package: #'Microdown-ParentChildrenChecker' with: [
spec requires: #( #'Microdown' ) ];
package: #'Microdown-BookTester' with: [
spec requires: #( #'Microdown' ) ];
package: #'Microdown-BookTester-Tests' with: [
spec requires: #( #'Microdown-BookTester' ) ];

package: #'Microdown-Blog' with: [
spec requires: #( #'Microdown' ) ];
package: #'Microdown-Blog-Tests' with: [
spec requires: #( #'Microdown-Blog' ) ];
with: [ spec requires: #( #Microdown ) ];

package: #'Microdown-PrettyPrinter-Tests' with: [
spec requires: #( #'Microdown-PrettyPrinter'
#'Microdown-Tests' ) ].


package: #'Microdown-PrettyPrinter-Tests'
with: [ spec requires: #( #'Microdown-PrettyPrinter' #'Microdown-Tests') ].


"I do not want group without tests for now"
spec
group: 'Core' with: #( 'Microdown' );
group: 'Tests' with: #( 'Core' 'Microdown-Tests' );
group: 'RichText' with: #( 'Core' 'Microdown-RichTextComposer' );
group: 'Extensions'
with: #( #'Microdown-Evaluator' #'Microdown-Evaluator-Tests'
#'Microdown-PrettyPrinter' #'Microdown-PrettyPrinter-Tests'
#'Microdown-HTMLExporter' #'Microdown-HTMLExporter-Tests'
#'Microdown-LaTeXExporter' #'Microdown-LaTeXExporter-Tests'
#'Microdown-Transformer' #'Microdown-Transformer-Tests' );
group: 'All'
with: #( 'Core' 'Tests' 'Extensions' 'Microdown-Pharo-Tools'
'RichText' )
"
group: 'Core' with: #('Microdown');
group: 'Tests' with: #('Core' 'Microdown-Tests');
group: 'RichText' with: #('Core' 'Microdown-RichTextComposer' );
group: 'Extensions' with: #(
"
#'Microdown-RichTextPresenter'
#'Microdown-RichTextPresenter-Tests'
#'Microdown-DocumentBrowser'
#'Microdown-DocumentBrowser-Tests'
" ]
"
#'Microdown-Evaluator'
#'Microdown-Evaluator-Tests'
#'Microdown-PrettyPrinter'
#'Microdown-PrettyPrinter-Tests'
#'Microdown-HTMLExporter'
#'Microdown-HTMLExporter-Tests'
#'Microdown-LaTeXExporter'
#'Microdown-LaTeXExporter-Tests'
#'Microdown-Transformer'
#'Microdown-Transformer-Tests');
group: 'All' with: #('Core' 'Tests' 'Extensions' 'Microdown-Pharo-Tools' 'RichText') ]
]

{ #category : 'external projects' }
Expand Down
85 changes: 80 additions & 5 deletions src/Microdown-Blog-Tests/MicAbstractBlogCreatorTest.class.st
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
Class {
#name : 'MicAbstractBlogCreatorTest',
#superclass : 'TestCase',
#instVars : [
'abstractBlog'
],
#category : 'Microdown-Blog-Tests',
#package : 'Microdown-Blog-Tests'
}
Expand All @@ -16,12 +19,21 @@ MicAbstractBlogCreatorTest class >> testMakeALinkTo [
equals: link
]

{ #category : 'running' }
MicAbstractBlogCreatorTest >> setUp [
super setUp.

"Put here a common initialization logic for tests"

abstractBlog := MicAbstractBlogCreator new
]

{ #category : 'tests' }
MicAbstractBlogCreatorTest >> testMakeALinkTo [

| link |
link := MicAbstractBlogCreator new makeALink: 'Pharo is cool' to: 'Test'.
| link |
link := abstractBlog makeALink: 'Pharo is cool' to: 'Test' asFileReference.

self
assert: (link isKindOf: MicLinkBlock);
assert: link plainText equals: '[Pharo is cool](Test)'
Expand All @@ -31,7 +43,7 @@ MicAbstractBlogCreatorTest >> testMakeALinkTo [
MicAbstractBlogCreatorTest >> testMakeALinkToWithEmptyArguments [

| link |
link := MicAbstractBlogCreator new makeALink: '' to: ''.
link := abstractBlog makeALink: '' to: ''.

self
assert: (link isKindOf: MicLinkBlock);
Expand All @@ -42,9 +54,72 @@ MicAbstractBlogCreatorTest >> testMakeALinkToWithEmptyArguments [
MicAbstractBlogCreatorTest >> testMakeALinkToWithNilArguments [

| link |
link := MicAbstractBlogCreator new makeALink: nil to: nil.
link := abstractBlog makeALink: nil to: nil.

self
assert: (link isKindOf: MicLinkBlock);
assert: link plainText equals: '[Undefined](Undefined)'
]

{ #category : 'tests' }
MicAbstractBlogCreatorTest >> testVerifyDateMetadata [

| root metadata |
root := MicRootBlock new.
metadata := MicMetaDataBlock new.
metadata body: Dictionary new.
metadata atKey: #date put: '2021/05/21'.
root addChild: metadata.

root := abstractBlog verifyDateMetadata: root.

self assert: (root isKindOf: MicRootBlock).
metadata := root children first.
self assert: (metadata atKey: #date) equals: '2021/05/21'
]

{ #category : 'tests' }
MicAbstractBlogCreatorTest >> testVerifyDateMetadataWithInvalidDate [

| root metadata |
root := MicRootBlock new.
metadata := MicMetaDataBlock new.
metadata body: Dictionary new.
metadata atKey: #date put: '20215612345'.
root addChild: metadata.

root := abstractBlog verifyDateMetadata: root.

self assert: (root isKindOf: MicRootBlock).
metadata := root children first.
self assert: (metadata atKey: #date) equals: abstractBlog replacementDate
]

{ #category : 'tests' }
MicAbstractBlogCreatorTest >> testVerifyDateMetadataWithoutDate [

| root metadata |
root := MicRootBlock new.
metadata := MicMetaDataBlock new.
metadata body: Dictionary new.
root addChild: metadata.

root := abstractBlog verifyDateMetadata: root.

self assert: (root isKindOf: MicRootBlock).
metadata := root children first.
self assert: (metadata atKey: #date) equals: abstractBlog replacementDate
]

{ #category : 'tests' }
MicAbstractBlogCreatorTest >> testVerifyDateMetadataWithoutMetadata [

| root metadata |
root := MicRootBlock new.

root := MicAbstractBlogCreator new verifyDateMetadata: root.

self assert: (root isKindOf: MicRootBlock).
metadata := root children first.
self assert: (metadata atKey: #date) equals: abstractBlog replacementDate
]
Loading

0 comments on commit 34ebfe6

Please sign in to comment.