-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #748 from moufort/webDeveloppemment
Refactoring and add Test in Microdown-Blog
- Loading branch information
Showing
10 changed files
with
223 additions
and
143 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
Class { | ||
#name : 'MicMonthListCreatorTest', | ||
#superclass : 'TestCase', | ||
#category : 'Microdown-Blog-Tests', | ||
#package : 'Microdown-Blog-Tests' | ||
} | ||
|
||
{ #category : 'tests' } | ||
MicMonthListCreatorTest >> numberOfMonthSince2014 [ | ||
|
||
^ Date today year - 2014 * 12 + Date today month index | ||
] | ||
|
||
{ #category : 'tests' } | ||
MicMonthListCreatorTest >> testGenerateDateListSince2014 [ | ||
|
||
| dateList | | ||
|
||
dateList := MicMonthListCreator new generateDateListSince2014. | ||
|
||
self assert: dateList size equals: (Date today year - 2014)*12 + Date today month index . | ||
self assert: dateList first equals: (Date newDay: 1 month: 1 year: 2014) month . | ||
self assert: dateList last equals: Date today month . | ||
] | ||
|
||
{ #category : 'tests' } | ||
MicMonthListCreatorTest >> testGenerateMicListBlockOfLinkDateTo [ | ||
|
||
| dateList | | ||
dateList := MicMonthListCreator new | ||
generateMicListBlockOfLinkDateTo: '/html'. | ||
|
||
self assert: (dateList isKindOf: MicUnorderedListBlock). | ||
self | ||
assert: dateList children size | ||
equals: self numberOfMonthSince2014. | ||
] |
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,35 @@ | ||
Class { | ||
#name : 'MicAbstractBlogCreator', | ||
#superclass : 'Object', | ||
#instVars : [ | ||
'targetDirectory' | ||
], | ||
#category : 'Microdown-Blog', | ||
#package : 'Microdown-Blog' | ||
} | ||
|
||
{ #category : 'as yet unclassified' } | ||
MicAbstractBlogCreator >> makeALink: aText to: aLink [ | ||
|
||
| text link | | ||
(aText isNil or: aText isEmpty) | ||
ifTrue: [ text := 'Undefined' ] | ||
ifFalse: [ text := aText ]. | ||
(aLink isNil or: aLink isEmpty) | ||
ifTrue: [ link := 'Undefined' ] | ||
ifFalse: [ link := aLink ]. | ||
|
||
^ (MicInlineParser parse: '[' , text , '](' , link , ')') first | ||
] | ||
|
||
{ #category : 'accessing' } | ||
MicAbstractBlogCreator >> targetDirectory [ | ||
|
||
^ targetDirectory | ||
] | ||
|
||
{ #category : 'accessing' } | ||
MicAbstractBlogCreator >> targetDirectory: target [ | ||
|
||
targetDirectory := target | ||
] |
Oops, something went wrong.