David T. Lewis uploaded a new version of CollectionsTests to project The Inbox:
http://source.squeak.org/inbox/CollectionsTests-dtl.209.mcz ==================== Summary ==================== Name: CollectionsTests-dtl.209 Author: dtl Time: 2 January 2014, 3:55:41.062 pm UUID: 5681f129-af93-4f97-9449-b2391be6c8a3 Ancestors: CollectionsTests-fbs.208 Provide TextAttributesScanningTest to verify text attribute filein and fileout. Five tests are marked as expected failures. These are tests for text attributes that are apparently unused, and that are likely candidates for removal from the image. There is one failure in a test for PluggableTextAttribute, which is a kind of text attribute that is used by SqueakMap. This is probably a legitimate failure that should be fixed. =============== Diff against CollectionsTests-fbs.208 =============== Item was added: + TestCase subclass: #TextAttributesScanningTest + instanceVariableNames: '' + classVariableNames: '' + poolDictionaries: '' + category: 'CollectionsTests-Text'! + + !TextAttributesScanningTest commentStamp: '<historical>' prior: 0! + A TextAttributesTest verifies storing and reading text attributes in file out chunk format. + ! Item was added: + ----- Method: TextAttributesScanningTest>>expectedFailures (in category 'running') ----- + expectedFailures + "Tests for text attributes that are apparently unused, and that may be candidates + for removal from the image" + ^#( + testTextAnchor + testTextIndent + testTextMessageLink + testTextPlusJumpStart + testTextPlusJumpEnd + )! Item was added: + ----- Method: TextAttributesScanningTest>>testPluggableTextAttribute (in category 'testing') ----- + testPluggableTextAttribute + | att strm | + att := PluggableTextAttribute evalBlock: [ #foo ]. + strm := ReadWriteStream on: ''. + self assert: (att respondsTo: #writeScanOn:). + att writeScanOn: strm. + "FIXME: PluggableTextAttribute used by SqueakMap. Currently it cannot + be filed out, so this probably needs fixing. See RunArray class>>scanFrom:" + ! Item was added: + ----- Method: TextAttributesScanningTest>>testRunArrayScan (in category 'testing') ----- + testRunArrayScan + | ra ra2 strm | + ra := RunArray scanFrom: (ReadStream on: '(14 50 312)f1,f1b,f1LInteger +;i'). + strm := ReadWriteStream on: ''. + ra writeScanOn: strm. + strm reset. + ra2 := RunArray scanFrom: strm. + self assert: ra2 equals: ra + ! Item was added: + ----- Method: TextAttributesScanningTest>>testTextAction (in category 'testing') ----- + testTextAction + self assert: true + description: 'TextAction is abstract and does not need to support text filein and fileout'. + ! Item was added: + ----- Method: TextAttributesScanningTest>>testTextAlignment (in category 'testing') ----- + testTextAlignment + | att strm att2 identifierCharacter att3 att4 | + att := TextAlignment leftFlush. + strm := ReadWriteStream on: ''. + att writeScanOn: strm. + strm reset. + identifierCharacter := strm next. + self assert: identifierCharacter equals: $a. + att2 :=TextAlignment new alignment: (Integer readFrom: strm ifFail: [-1]). + self assert: att equals: att2. + self assert: (TextAttribute classFor: $a) equals: TextAlignment. + + strm reset. + identifierCharacter := strm next. + self assert: identifierCharacter equals: $a. + att3 := TextAlignment scanFrom: strm. + self assert: att equals: att3. + self assert: (TextAttribute classFor: $a) equals: TextAlignment. + + strm reset. + att4 := TextAttribute newFrom: strm. + self assert: att equals: att4.! Item was added: + ----- Method: TextAttributesScanningTest>>testTextAnchor (in category 'testing') ----- + testTextAnchor + | att strm | + att := TextAnchor new anchoredMorph: RectangleMorph new initialize. + strm := ReadWriteStream on: ''. + self assert: (att respondsTo: #writeScanOn:). + att writeScanOn: strm. "FIXME - is TextAnchor used for anything?" + ! Item was added: + ----- Method: TextAttributesScanningTest>>testTextAttributeClassFor (in category 'testing') ----- + testTextAttributeClassFor + "Verify class identifiers as used in RunArray class>>scanFrom:" + + self assert: (TextAttribute classFor: $a) equals: TextAlignment. + self assert: (TextAttribute classFor: $f) equals: TextFontChange. + self assert: (TextAttribute classFor: $F) equals: TextFontReference. + self assert: (TextAttribute classFor: $b) equals: TextEmphasis. + self assert: (TextAttribute classFor: $i) equals: TextEmphasis. + self assert: (TextAttribute classFor: $u) equals: TextEmphasis. + self assert: (TextAttribute classFor: $=) equals: TextEmphasis. + self assert: (TextAttribute classFor: $n) equals: TextEmphasis. + self assert: (TextAttribute classFor: $-) equals: TextKern. + self assert: (TextAttribute classFor: $+) equals: TextKern. + self assert: (TextAttribute classFor: $c) equals: TextColor. + self assert: (TextAttribute classFor: $L) equals: TextLink. + self assert: (TextAttribute classFor: $R) equals: TextURL. + self assert: (TextAttribute classFor: $q) equals: TextSqkPageLink. + self assert: (TextAttribute classFor: $p) equals: TextSqkProjectLink. + self assert: (TextAttribute classFor: $P) equals: TextPrintIt. + self assert: (TextAttribute classFor: $d) equals: TextDoIt. + + ! Item was added: + ----- Method: TextAttributesScanningTest>>testTextColor (in category 'testing') ----- + testTextColor + | att strm att2 att3 identifierCharacter | + att := TextColor color: Color red. + strm := ReadWriteStream on: ''. + att writeScanOn: strm. + strm reset. + identifierCharacter := strm next. + self assert: identifierCharacter equals: $c. + att2 := TextColor scanFrom: strm. + self assert: att equals: att2. + self assert: (TextAttribute classFor: $c) equals: TextColor. + strm reset. + att3 := TextAttribute newFrom: strm. + self assert: att equals: att3. + ! Item was added: + ----- Method: TextAttributesScanningTest>>testTextDoIt (in category 'testing') ----- + testTextDoIt + | att strm att2 identifierCharacter att3 | + att := TextDoIt evalString: 'foo'. + strm := ReadWriteStream on: ''. + att writeScanOn: strm. + strm reset. + identifierCharacter := strm next. + self assert: identifierCharacter equals: $d. + att2 := TextDoIt scanFrom: strm. + self assert: att equals: att2. + self assert: (TextAttribute classFor: $d) equals: TextDoIt. + strm reset. + att3 := TextAttribute newFrom: strm. + self assert: att equals: att3.! Item was added: + ----- Method: TextAttributesScanningTest>>testTextEmphasisBold (in category 'testing') ----- + testTextEmphasisBold + | att strm identifierCharacter att3 | + att := TextEmphasis bold. + strm := ReadWriteStream on: ''. + att writeScanOn: strm. + strm reset. + identifierCharacter := strm next. + self assert: identifierCharacter equals: $b. + self assert: strm atEnd. + self assert: (TextAttribute classFor: $b) equals: TextEmphasis. + strm reset. + att3 := TextAttribute newFrom: strm. + self assert: att equals: att3. + ! Item was added: + ----- Method: TextAttributesScanningTest>>testTextEmphasisItalic (in category 'testing') ----- + testTextEmphasisItalic + | att strm identifierCharacter att3 | + att := TextEmphasis italic. + strm := ReadWriteStream on: ''. + att writeScanOn: strm. + strm reset. + identifierCharacter := strm next. + self assert: identifierCharacter equals: $i. + self assert: strm atEnd. + self assert: (TextAttribute classFor: $i) equals: TextEmphasis. + strm reset. + att3 := TextAttribute newFrom: strm. + self assert: att equals: att3. + ! Item was added: + ----- Method: TextAttributesScanningTest>>testTextEmphasisNormal (in category 'testing') ----- + testTextEmphasisNormal + | att strm identifierCharacter att3 | + att := TextEmphasis normal. + strm := ReadWriteStream on: ''. + att writeScanOn: strm. + strm reset. + identifierCharacter := strm next. + self assert: identifierCharacter equals: $n. + self assert: strm atEnd. + self assert: (TextAttribute classFor: $n) equals: TextEmphasis. + strm reset. + att3 := TextAttribute newFrom: strm. + self assert: att equals: att3. + ! Item was added: + ----- Method: TextAttributesScanningTest>>testTextEmphasisStruckOut (in category 'testing') ----- + testTextEmphasisStruckOut + | att strm identifierCharacter att3 | + att := TextEmphasis struckOut. + strm := ReadWriteStream on: ''. + att writeScanOn: strm. + strm reset. + identifierCharacter := strm next. + self assert: identifierCharacter equals: $=. + self assert: strm atEnd. + self assert: (TextAttribute classFor: $=) equals: TextEmphasis. + strm reset. + att3 := TextAttribute newFrom: strm. + self assert: att equals: att3. + ! Item was added: + ----- Method: TextAttributesScanningTest>>testTextEmphasisUnderlined (in category 'testing') ----- + testTextEmphasisUnderlined + | att strm identifierCharacter att3 | + att := TextEmphasis underlined. + strm := ReadWriteStream on: ''. + att writeScanOn: strm. + strm reset. + identifierCharacter := strm next. + self assert: identifierCharacter equals: $u. + self assert: strm atEnd. + self assert: (TextAttribute classFor: $u) equals: TextEmphasis. + strm reset. + att3 := TextAttribute newFrom: strm. + self assert: att equals: att3. + ! Item was added: + ----- Method: TextAttributesScanningTest>>testTextFontChange (in category 'testing') ----- + testTextFontChange + | att strm att2 identifierCharacter att3 | + att := TextFontChange font3. + strm := ReadWriteStream on: ''. + att writeScanOn: strm. + strm reset. + identifierCharacter := strm next. + self assert: identifierCharacter equals: $f. + att2 := TextFontChange new fontNumber: (Integer readFrom: strm ifFail: [0]). + self assert: att equals: att2. + self assert: (TextAttribute classFor: $f) equals: TextFontChange. + strm reset. + att3 := TextAttribute newFrom: strm. + self assert: att equals: att3.! Item was added: + ----- Method: TextAttributesScanningTest>>testTextFontReference (in category 'testing') ----- + testTextFontReference + | font att strm identifierCharacter fontReferenceString att3 | + font := StrikeFont someInstance. + att := TextFontReference toFont: font. + strm := ReadWriteStream on: ''. + att writeScanOn: strm. + strm reset. + identifierCharacter := strm next. + self assert: identifierCharacter equals: $F. + fontReferenceString := strm upToEnd. + self assert: fontReferenceString equals: font familyName, '#', font height. + self assert: (TextAttribute classFor: $F) equals: TextFontReference. + strm reset. + att3 := TextAttribute newFrom: strm. + self assert: att equals: att3. + ! Item was added: + ----- Method: TextAttributesScanningTest>>testTextIndent (in category 'testing') ----- + testTextIndent + "TextIndent is unused and does not have in implemention to support text + filein and fileout. See TextAlignment for its likely replacement." + self fail: 'TextIndent is apparently unused'! Item was added: + ----- Method: TextAttributesScanningTest>>testTextKern (in category 'testing') ----- + testTextKern + | att strm att2 att3 | + + att := TextKern kern: 5. + strm := ReadWriteStream on: ''. + att writeScanOn: strm. + strm reset. + 5 timesRepeat: [self assert: strm next equals: $+]. + self assert: strm atEnd. + strm reset. + att2 := TextAttribute newFrom: strm. + self assert: att equals: att2. + + att := TextKern kern: -5. + strm := ReadWriteStream on: ''. + att writeScanOn: strm. + strm reset. + 5 timesRepeat: [self assert: strm next equals: $-]. + self assert: strm atEnd. + strm reset. + att3 := TextAttribute newFrom: strm. + self assert: att equals: att3.! Item was added: + ----- Method: TextAttributesScanningTest>>testTextLink (in category 'testing') ----- + testTextLink + | att strm att2 identifierCharacter att3 | + att := TextLink new classAndMethod: 'class and method string'. + strm := ReadWriteStream on: ''. + att writeScanOn: strm. + strm reset. + identifierCharacter := strm next. + self assert: identifierCharacter equals: $L. + att2 := TextLink scanFrom: strm. + self assert: att equals: att2. + self assert: (TextAttribute classFor: $L) equals: TextLink. + strm reset. + att3 := TextAttribute newFrom: strm. + self assert: att equals: att3.! Item was added: + ----- Method: TextAttributesScanningTest>>testTextMessageLink (in category 'testing') ----- + testTextMessageLink + | att strm | + att := TextMessageLink message: Message someInstance. + strm := ReadWriteStream on: ''. + self assert: (att respondsTo: #writeScanOn:). + att writeScanOn: strm. "FIXME - is TextMessageLink used for anything?" + ! Item was added: + ----- Method: TextAttributesScanningTest>>testTextPlusJumpEnd (in category 'testing') ----- + testTextPlusJumpEnd + | att strm | + att := TextPlusJumpEnd new jumpLabel: 'this is a jump label'. + strm := ReadWriteStream on: ''. + self assert: (att respondsTo: #writeScanOn:). + att writeScanOn: strm. "FIXME - is TextPlusJumpEnd used for anything?" + ! Item was added: + ----- Method: TextAttributesScanningTest>>testTextPlusJumpStart (in category 'testing') ----- + testTextPlusJumpStart + | att strm | + att := TextPlusJumpStart new jumpLabel: 'this is a jump label'. + strm := ReadWriteStream on: ''. + self assert: (att respondsTo: #writeScanOn:). + att writeScanOn: strm. "FIXME - is TextPlusJumpStart used for anything?" + ! Item was added: + ----- Method: TextAttributesScanningTest>>testTextPrintIt (in category 'testing') ----- + testTextPrintIt + | att strm att2 identifierCharacter att3 | + att := TextPrintIt evalString: 'foo'. + strm := ReadWriteStream on: ''. + att writeScanOn: strm. + strm reset. + identifierCharacter := strm next. + self assert: identifierCharacter equals: $P. + att2 := TextPrintIt scanFrom: strm. + self assert: att equals: att2. + self assert: (TextAttribute classFor: $P) equals: TextPrintIt. + strm reset. + att3 := TextAttribute newFrom: strm. + self assert: att equals: att3.! Item was added: + ----- Method: TextAttributesScanningTest>>testTextSqkPageLink (in category 'testing') ----- + testTextSqkPageLink + | att strm att2 identifierCharacter att3 | + att := TextSqkPageLink new url: 'a URL string'. + strm := ReadWriteStream on: ''. + att writeScanOn: strm. + strm reset. + identifierCharacter := strm next. + self assert: identifierCharacter equals: $q. + att2 := TextSqkPageLink scanFrom: strm. + self assert: att equals: att2. + self assert: (TextAttribute classFor: $q) equals: TextSqkPageLink. + strm reset. + att3 := TextAttribute newFrom: strm. + self assert: att equals: att3.! Item was added: + ----- Method: TextAttributesScanningTest>>testTextSqkProjectLink (in category 'testing') ----- + testTextSqkProjectLink + | att strm att2 identifierCharacter att3 | + att := TextSqkProjectLink new url: 'a URL string'. + strm := ReadWriteStream on: ''. + att writeScanOn: strm. + strm reset. + identifierCharacter := strm next. + self assert: identifierCharacter equals: $p. + att2 := TextSqkProjectLink scanFrom: strm. + self assert: att equals: att2. + self assert: (TextAttribute classFor: $p) equals: TextSqkProjectLink. + strm reset. + att3 := TextAttribute newFrom: strm. + self assert: att equals: att3.! Item was added: + ----- Method: TextAttributesScanningTest>>testTextURL (in category 'testing') ----- + testTextURL + | att strm att2 identifierCharacter att3 | + att := TextURL new url: 'a URL string'. + strm := ReadWriteStream on: ''. + att writeScanOn: strm. + strm reset. + identifierCharacter := strm next. + self assert: identifierCharacter equals: $R. + att2 := TextURL scanFrom: strm. + self assert: att equals: att2. + self assert: (TextAttribute classFor: $R) equals: TextURL. + strm reset. + att3 := TextAttribute newFrom: strm. + self assert: att equals: att3.! |
On 2 January 2014 20:55, <[hidden email]> wrote:
> David T. Lewis uploaded a new version of CollectionsTests to project The Inbox: > http://source.squeak.org/inbox/CollectionsTests-dtl.209.mcz > > ==================== Summary ==================== > > Name: CollectionsTests-dtl.209 > Author: dtl > Time: 2 January 2014, 3:55:41.062 pm > UUID: 5681f129-af93-4f97-9449-b2391be6c8a3 > Ancestors: CollectionsTests-fbs.208 > > Provide TextAttributesScanningTest to verify text attribute filein and fileout. > > Five tests are marked as expected failures. These are tests for text attributes that are apparently unused, and that are likely candidates for removal from the image. > > There is one failure in a test for PluggableTextAttribute, which is a kind of text attribute that is used by SqueakMap. This is probably a legitimate failure that should be fixed. > > =============== Diff against CollectionsTests-fbs.208 =============== > Item was added: > + ----- Method: TextAttributesScanningTest>>testTextAttributeClassFor (in category 'testing') ----- > + testTextAttributeClassFor > + "Verify class identifiers as used in RunArray class>>scanFrom:" > + > + self assert: (TextAttribute classFor: $a) equals: TextAlignment. > + self assert: (TextAttribute classFor: $f) equals: TextFontChange. > + self assert: (TextAttribute classFor: $F) equals: TextFontReference. > + self assert: (TextAttribute classFor: $b) equals: TextEmphasis. > + self assert: (TextAttribute classFor: $i) equals: TextEmphasis. > + self assert: (TextAttribute classFor: $u) equals: TextEmphasis. > + self assert: (TextAttribute classFor: $=) equals: TextEmphasis. > + self assert: (TextAttribute classFor: $n) equals: TextEmphasis. > + self assert: (TextAttribute classFor: $-) equals: TextKern. > + self assert: (TextAttribute classFor: $+) equals: TextKern. > + self assert: (TextAttribute classFor: $c) equals: TextColor. > + self assert: (TextAttribute classFor: $L) equals: TextLink. > + self assert: (TextAttribute classFor: $R) equals: TextURL. > + self assert: (TextAttribute classFor: $q) equals: TextSqkPageLink. > + self assert: (TextAttribute classFor: $p) equals: TextSqkProjectLink. > + self assert: (TextAttribute classFor: $P) equals: TextPrintIt. > + self assert: (TextAttribute classFor: $d) equals: TextDoIt. Yay for #assert:equals:! The expected value goes first, though: otherwise you get a message something like "Expected actualValue but was expectedValue". The same applies, as far as I can see, to the other #assert:equals: calls. frank |
On 03.01.2014, at 20:11, Frank Shearar <[hidden email]> wrote: > On 2 January 2014 20:55, <[hidden email]> wrote: >> David T. Lewis uploaded a new version of CollectionsTests to project The Inbox: >> http://source.squeak.org/inbox/CollectionsTests-dtl.209.mcz >> >> ==================== Summary ==================== >> >> Name: CollectionsTests-dtl.209 >> Author: dtl >> Time: 2 January 2014, 3:55:41.062 pm >> UUID: 5681f129-af93-4f97-9449-b2391be6c8a3 >> Ancestors: CollectionsTests-fbs.208 >> >> Provide TextAttributesScanningTest to verify text attribute filein and fileout. >> >> Five tests are marked as expected failures. These are tests for text attributes that are apparently unused, and that are likely candidates for removal from the image. >> >> There is one failure in a test for PluggableTextAttribute, which is a kind of text attribute that is used by SqueakMap. This is probably a legitimate failure that should be fixed. >> >> =============== Diff against CollectionsTests-fbs.208 =============== > <snip> >> Item was added: >> + ----- Method: TextAttributesScanningTest>>testTextAttributeClassFor (in category 'testing') ----- >> + testTextAttributeClassFor >> + "Verify class identifiers as used in RunArray class>>scanFrom:" >> + >> + self assert: (TextAttribute classFor: $a) equals: TextAlignment. >> + self assert: (TextAttribute classFor: $f) equals: TextFontChange. >> + self assert: (TextAttribute classFor: $F) equals: TextFontReference. >> + self assert: (TextAttribute classFor: $b) equals: TextEmphasis. >> + self assert: (TextAttribute classFor: $i) equals: TextEmphasis. >> + self assert: (TextAttribute classFor: $u) equals: TextEmphasis. >> + self assert: (TextAttribute classFor: $=) equals: TextEmphasis. >> + self assert: (TextAttribute classFor: $n) equals: TextEmphasis. >> + self assert: (TextAttribute classFor: $-) equals: TextKern. >> + self assert: (TextAttribute classFor: $+) equals: TextKern. >> + self assert: (TextAttribute classFor: $c) equals: TextColor. >> + self assert: (TextAttribute classFor: $L) equals: TextLink. >> + self assert: (TextAttribute classFor: $R) equals: TextURL. >> + self assert: (TextAttribute classFor: $q) equals: TextSqkPageLink. >> + self assert: (TextAttribute classFor: $p) equals: TextSqkProjectLink. >> + self assert: (TextAttribute classFor: $P) equals: TextPrintIt. >> + self assert: (TextAttribute classFor: $d) equals: TextDoIt. > > Yay for #assert:equals:! The expected value goes first, though: > otherwise you get a message something like "Expected actualValue but > was expectedValue". The same applies, as far as I can see, to the > other #assert:equals: calls. Is that ansi? I like the usage as in the example better.. Best -Tobias signature.asc (1K) Download Attachment |
On 3 January 2014 19:28, Tobias Pape <[hidden email]> wrote:
> > On 03.01.2014, at 20:11, Frank Shearar <[hidden email]> wrote: > >> On 2 January 2014 20:55, <[hidden email]> wrote: >>> David T. Lewis uploaded a new version of CollectionsTests to project The Inbox: >>> http://source.squeak.org/inbox/CollectionsTests-dtl.209.mcz >>> >>> ==================== Summary ==================== >>> >>> Name: CollectionsTests-dtl.209 >>> Author: dtl >>> Time: 2 January 2014, 3:55:41.062 pm >>> UUID: 5681f129-af93-4f97-9449-b2391be6c8a3 >>> Ancestors: CollectionsTests-fbs.208 >>> >>> Provide TextAttributesScanningTest to verify text attribute filein and fileout. >>> >>> Five tests are marked as expected failures. These are tests for text attributes that are apparently unused, and that are likely candidates for removal from the image. >>> >>> There is one failure in a test for PluggableTextAttribute, which is a kind of text attribute that is used by SqueakMap. This is probably a legitimate failure that should be fixed. >>> >>> =============== Diff against CollectionsTests-fbs.208 =============== >> <snip> >>> Item was added: >>> + ----- Method: TextAttributesScanningTest>>testTextAttributeClassFor (in category 'testing') ----- >>> + testTextAttributeClassFor >>> + "Verify class identifiers as used in RunArray class>>scanFrom:" >>> + >>> + self assert: (TextAttribute classFor: $a) equals: TextAlignment. >>> + self assert: (TextAttribute classFor: $f) equals: TextFontChange. >>> + self assert: (TextAttribute classFor: $F) equals: TextFontReference. >>> + self assert: (TextAttribute classFor: $b) equals: TextEmphasis. >>> + self assert: (TextAttribute classFor: $i) equals: TextEmphasis. >>> + self assert: (TextAttribute classFor: $u) equals: TextEmphasis. >>> + self assert: (TextAttribute classFor: $=) equals: TextEmphasis. >>> + self assert: (TextAttribute classFor: $n) equals: TextEmphasis. >>> + self assert: (TextAttribute classFor: $-) equals: TextKern. >>> + self assert: (TextAttribute classFor: $+) equals: TextKern. >>> + self assert: (TextAttribute classFor: $c) equals: TextColor. >>> + self assert: (TextAttribute classFor: $L) equals: TextLink. >>> + self assert: (TextAttribute classFor: $R) equals: TextURL. >>> + self assert: (TextAttribute classFor: $q) equals: TextSqkPageLink. >>> + self assert: (TextAttribute classFor: $p) equals: TextSqkProjectLink. >>> + self assert: (TextAttribute classFor: $P) equals: TextPrintIt. >>> + self assert: (TextAttribute classFor: $d) equals: TextDoIt. >> >> Yay for #assert:equals:! The expected value goes first, though: >> otherwise you get a message something like "Expected actualValue but >> was expectedValue". The same applies, as far as I can see, to the >> other #assert:equals: calls. > > Which is a counter-intuitive order for me... > Is that ansi? It's SUnit. I don't particularly like it, but that's the API. What I'd _really_ like is something like Phexample syntax, which would have (TextAttribute classFor: $d) should = TextDoIt. (Very RSpec-ish. Having said that, RSpec's moved away from should syntax because it requires monkey patching. So `foo should == :bar` is now `expect(foo).to eq(:bar)`. Translating that back into Smalltalk would probably look something like `Expect this: (TextAttribute classFor: $d) toEqual: TextDoIt`. Ack!) > I like the usage as in the example better.. I agree. I just held my nose and adapted. Altering the API means never being sure that you changed everything, and when you get it wrong you make someone's life a misery because their debug error message, meant to _aid_ them, now _lies_ to them. frank > Best > -Tobias |
On 03.01.2014, at 20:44, Frank Shearar <[hidden email]> wrote: > On 3 January 2014 19:28, Tobias Pape <[hidden email]> wrote: >> >> On 03.01.2014, at 20:11, Frank Shearar <[hidden email]> wrote: >> >>> On 2 January 2014 20:55, <[hidden email]> wrote: >>>> David T. Lewis uploaded a new version of CollectionsTests to project The Inbox: >>>> http://source.squeak.org/inbox/CollectionsTests-dtl.209.mcz >>>> >>>> ==================== Summary ==================== >>>> >>>> Name: CollectionsTests-dtl.209 >>>> Author: dtl >>>> Time: 2 January 2014, 3:55:41.062 pm >>>> UUID: 5681f129-af93-4f97-9449-b2391be6c8a3 >>>> Ancestors: CollectionsTests-fbs.208 >>>> >>>> Provide TextAttributesScanningTest to verify text attribute filein and fileout. >>>> >>>> Five tests are marked as expected failures. These are tests for text attributes that are apparently unused, and that are likely candidates for removal from the image. >>>> >>>> There is one failure in a test for PluggableTextAttribute, which is a kind of text attribute that is used by SqueakMap. This is probably a legitimate failure that should be fixed. >>>> >>>> =============== Diff against CollectionsTests-fbs.208 =============== >>> <snip> >>>> Item was added: >>>> + ----- Method: TextAttributesScanningTest>>testTextAttributeClassFor (in category 'testing') ----- >>>> + testTextAttributeClassFor >>>> + "Verify class identifiers as used in RunArray class>>scanFrom:" >>>> + >>>> + self assert: (TextAttribute classFor: $a) equals: TextAlignment. >>>> + self assert: (TextAttribute classFor: $f) equals: TextFontChange. >>>> + self assert: (TextAttribute classFor: $F) equals: TextFontReference. >>>> + self assert: (TextAttribute classFor: $b) equals: TextEmphasis. >>>> + self assert: (TextAttribute classFor: $i) equals: TextEmphasis. >>>> + self assert: (TextAttribute classFor: $u) equals: TextEmphasis. >>>> + self assert: (TextAttribute classFor: $=) equals: TextEmphasis. >>>> + self assert: (TextAttribute classFor: $n) equals: TextEmphasis. >>>> + self assert: (TextAttribute classFor: $-) equals: TextKern. >>>> + self assert: (TextAttribute classFor: $+) equals: TextKern. >>>> + self assert: (TextAttribute classFor: $c) equals: TextColor. >>>> + self assert: (TextAttribute classFor: $L) equals: TextLink. >>>> + self assert: (TextAttribute classFor: $R) equals: TextURL. >>>> + self assert: (TextAttribute classFor: $q) equals: TextSqkPageLink. >>>> + self assert: (TextAttribute classFor: $p) equals: TextSqkProjectLink. >>>> + self assert: (TextAttribute classFor: $P) equals: TextPrintIt. >>>> + self assert: (TextAttribute classFor: $d) equals: TextDoIt. >>> >>> Yay for #assert:equals:! The expected value goes first, though: >>> otherwise you get a message something like "Expected actualValue but >>> was expectedValue". The same applies, as far as I can see, to the >>> other #assert:equals: calls. >> >> Which is a counter-intuitive order for me... >> Is that ansi? > > It's SUnit. I don't particularly like it, but that's the API. > > What I'd _really_ like is something like Phexample syntax, which would have > > (TextAttribute classFor: $d) should = TextDoIt. > > (Very RSpec-ish. Having said that, RSpec's moved away from should > syntax because it requires monkey patching. So `foo should == :bar` is > now `expect(foo).to eq(:bar)`. Translating that back into Smalltalk > would probably look something like `Expect this: (TextAttribute > classFor: $d) toEqual: TextDoIt`. Ack!) `Expect this: (TextAttribute classFor: $d) toEqual: TextDoIt` can easily be: self assertThat: (TextAttribute classFor: $d) isEqualTo: TextDoIt (which is near self assert: a equals: b, but the other way round again ;) What about a) instvar named `it' and initialised to self or b) method named #it that returns self (or what the user wants, like an "asserter") and do it should: (TextAttribute classFor: $d) beEqualTo: TextDoIt or self it should: (TextAttribute classFor: $d) beEqualTo: TextDoIt > >> I like the usage as in the example better.. > > I agree. I just held my nose and adapted. Altering the API means never > being sure that you changed everything, and when you get it wrong you > make someone's life a misery because their debug error message, meant > to _aid_ them, now _lies_ to them. HmHmmm. But frankly, most people do not look up the argument names and just use it intuitively and they then “think” the system is lying (while it is not)… Best -Tobias signature.asc (1K) Download Attachment |
In reply to this post by Frank Shearar-3
On Fri, Jan 03, 2014 at 07:11:26PM +0000, Frank Shearar wrote:
> On 2 January 2014 20:55, <[hidden email]> wrote: > > Yay for #assert:equals:! The expected value goes first, though: > otherwise you get a message something like "Expected actualValue but > was expectedValue". The same applies, as far as I can see, to the > other #assert:equals: calls. Dang it, I wrote the whole darn thing wrong. Lucky for me it works either way because I don't have the energy to go rewrite it properly. Maybe we could add a new preference for #useBassAckwardsLogicInSUnit ;-) Dave |
On 4 January 2014 01:27, David T. Lewis <[hidden email]> wrote:
> On Fri, Jan 03, 2014 at 07:11:26PM +0000, Frank Shearar wrote: >> On 2 January 2014 20:55, <[hidden email]> wrote: >> >> Yay for #assert:equals:! The expected value goes first, though: >> otherwise you get a message something like "Expected actualValue but >> was expectedValue". The same applies, as far as I can see, to the >> other #assert:equals: calls. > > Dang it, I wrote the whole darn thing wrong. Lucky for me it works either > way because I don't have the energy to go rewrite it properly. > > Maybe we could add a new preference for #useBassAckwardsLogicInSUnit > > ;-) I can wholeheartedly sympathise. I think what I'll do is add an item to my todo list, and rewrite them myself. At any rate, that was my only issue with the commit, so +1 from me then. frank > Dave |
Free forum by Nabble | Edit this page |