-
Notifications
You must be signed in to change notification settings - Fork 8
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 #16 from sarahtathy/sarah-branch
add the tests for to create a file
- Loading branch information
Showing
15 changed files
with
327 additions
and
378 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
111 changes: 111 additions & 0 deletions
111
src/MicroEd-Spec-Tests/MDEditorFilePresenterTest.class.st
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,111 @@ | ||
Class { | ||
#name : 'MDEditorFilePresenterTest', | ||
#superclass : 'TestCase', | ||
#instVars : [ | ||
'window', | ||
'memoryFS', | ||
'presenter', | ||
'mdFile', | ||
'fileReference' | ||
], | ||
#category : 'MicroEd-Spec-Tests', | ||
#package : 'MicroEd-Spec-Tests' | ||
} | ||
|
||
{ #category : 'running' } | ||
MDEditorFilePresenterTest >> mockTextObject: aString [ | ||
|
||
^ SpTextPresenter new text: aString | ||
] | ||
|
||
{ #category : 'running' } | ||
MDEditorFilePresenterTest >> setUp [ | ||
|
||
| text | | ||
super setUp. | ||
memoryFS := FileSystem memory. | ||
presenter := MDEditorPresenter new. | ||
window := presenter open. | ||
text := 'This is just a test'. | ||
fileReference := memoryFS / 'aFileReference.txt'. | ||
fileReference writeStreamDo: [ | ||
:stream | stream nextPutAll: text ]. | ||
|
||
mdFile := MDFile newFromFileReference: fileReference. | ||
] | ||
|
||
{ #category : 'running' } | ||
MDEditorFilePresenterTest >> tearDown [ | ||
|
||
window ifNotNil: [ window close ]. | ||
fileReference ensureDelete. | ||
super tearDown. | ||
] | ||
|
||
{ #category : 'tests' } | ||
MDEditorFilePresenterTest >> testCleanAction [ | ||
|
||
presenter cleanInput. | ||
self assert: presenter textInputText equals: ''. | ||
self assert: presenter textOutputText equals: '' | ||
] | ||
|
||
{ #category : 'tests' } | ||
MDEditorFilePresenterTest >> testGotCurrentFileWhenIsNotSpecify [ | ||
|
||
self assert: presenter mdFile class equals: MDFile | ||
] | ||
|
||
{ #category : 'tests' } | ||
MDEditorFilePresenterTest >> testGotCurrentFileWhenIsSpecify [ | ||
|
||
presenter mdFile: mdFile. | ||
self assert: presenter mdFile class equals: MDFile | ||
] | ||
|
||
{ #category : 'tests' } | ||
MDEditorFilePresenterTest >> testGotMicrodownParser [ | ||
|
||
self assert: presenter microdownParser class equals: MicrodownParser | ||
] | ||
|
||
{ #category : 'tests' } | ||
MDEditorFilePresenterTest >> testGotSyntaxStateWhenIsNotSpecify [ | ||
|
||
presenter syntaxState: MDMicroDownSyntax new. | ||
self assert: presenter syntaxState class equals: MDMicroDownSyntax | ||
] | ||
|
||
{ #category : 'tests-interaction' } | ||
MDEditorFilePresenterTest >> testOpenIsWorkingSmokeTest [ | ||
|
||
self assert: window isOpen | ||
|
||
] | ||
|
||
{ #category : 'running' } | ||
MDEditorFilePresenterTest >> testSaveWithExtension [ | ||
|
||
| text textPresenter | | ||
text := 'This is just a test'. | ||
textPresenter := self mockTextObject: text. | ||
presenter mdFile: mdFile. | ||
presenter saveFile. | ||
|
||
self assert: mdFile extension equals: 'mic'. | ||
self assert: mdFile contents equals: text. | ||
|
||
] | ||
|
||
{ #category : 'tests' } | ||
MDEditorFilePresenterTest >> testTextInputTextIsNotSpecify [ | ||
|
||
self assert: presenter textInputText equals: '% Type your marked-up text here. Render it and see right the output generated as rich text', String cr, String cr, presenter syntaxState exampleText | ||
] | ||
|
||
{ #category : 'tests' } | ||
MDEditorFilePresenterTest >> testTextInputTextIsSpecify [ | ||
|
||
presenter textInputText: 'test'. | ||
self assert: presenter textInputText equals: 'test' | ||
] |
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 @@ | ||
Package { #name : 'MicroEd-Spec-Tests' } |
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 @@ | ||
Package { #name : 'MicroEd-Spec' } |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.