From 68489c67c22a433c4a0edd1c6e6610b33a1c4dad Mon Sep 17 00:00:00 2001 From: Torsten Bergmann Date: Tue, 28 May 2024 16:08:29 +0200 Subject: [PATCH] Quick fix for P13 --- .../ManifestXMLWriterTests.class.st | 12 +- .../XMLWriterRecordingFormatterProxy.class.st | 25 +-- src/XML-Writer-Tests/XMLWriterTest.class.st | 142 +++++++++--------- src/XML-Writer-Tests/package.st | 2 +- 4 files changed, 96 insertions(+), 85 deletions(-) diff --git a/src/XML-Writer-Tests/ManifestXMLWriterTests.class.st b/src/XML-Writer-Tests/ManifestXMLWriterTests.class.st index 4ce022f..267ed86 100644 --- a/src/XML-Writer-Tests/ManifestXMLWriterTests.class.st +++ b/src/XML-Writer-Tests/ManifestXMLWriterTests.class.st @@ -2,19 +2,21 @@ Please describe the package using the class comment of the included manifest class. The manifest class also includes other additional metadata for the package. These meta data are used by other tools such as the SmalllintManifestChecker and the critics Browser " Class { - #name : #ManifestXMLWriterTests, - #superclass : #PackageManifest, - #category : #'XML-Writer-Tests-Manifest' + #name : 'ManifestXMLWriterTests', + #superclass : 'PackageManifest', + #category : 'XML-Writer-Tests-Manifest', + #package : 'XML-Writer-Tests', + #tag : 'Manifest' } -{ #category : #'code-critics' } +{ #category : 'code-critics' } ManifestXMLWriterTests class >> ruleDetectContainsRuleV1FalsePositive [ ^ #(#(#(#RGMethodDefinition #(#XMLWriterRecordingFormatterProxy #receivedNextAll:with: #false)) #'2023-10-26T02:25:37.729304+02:00') ) ] -{ #category : #'code-critics' } +{ #category : 'code-critics' } ManifestXMLWriterTests class >> ruleLiteralArrayContainsSuspiciousTrueFalseOrNilRuleV1FalsePositive [ diff --git a/src/XML-Writer-Tests/XMLWriterRecordingFormatterProxy.class.st b/src/XML-Writer-Tests/XMLWriterRecordingFormatterProxy.class.st index 5baa31a..62a3140 100644 --- a/src/XML-Writer-Tests/XMLWriterRecordingFormatterProxy.class.st +++ b/src/XML-Writer-Tests/XMLWriterRecordingFormatterProxy.class.st @@ -2,35 +2,42 @@ Records sent formatter messages in a queue for testing. " Class { - #name : #XMLWriterRecordingFormatterProxy, - #superclass : #Object, + #name : 'XMLWriterRecordingFormatterProxy', + #superclass : 'Object', #instVars : [ 'messageQueue' ], - #category : #'XML-Writer-Tests-Utilities' + #category : 'XML-Writer-Tests-Utilities', + #package : 'XML-Writer-Tests', + #tag : 'Utilities' } -{ #category : #'reflective operations' } +{ #category : 'reflective operations' } XMLWriterRecordingFormatterProxy >> doesNotUnderstand: aMessage [ - (XMLWriterFormatter whichCategoryIncludesSelector: aMessage selector) - = #formatting ifTrue: [ messageQueue addLast: aMessage ] + | name | + name := (SystemVersion current major < 13) + ifTrue: [ XMLWriterFormatter whichCategoryIncludesSelector: aMessage selector ] + ifFalse: [ XMLWriterFormatter protocolNameOfSelector: aMessage selector ]. + + name = #formatting ifTrue: [ messageQueue addLast: aMessage ] + ] -{ #category : #initialization } +{ #category : 'initialization' } XMLWriterRecordingFormatterProxy >> initialize [ super initialize. messageQueue := OrderedCollection new ] -{ #category : #testing } +{ #category : 'testing' } XMLWriterRecordingFormatterProxy >> receivedNext: aSelector with: anArgument [ ^ self receivedNextAll: (Array with: aSelector) with: anArgument ] -{ #category : #testing } +{ #category : 'testing' } XMLWriterRecordingFormatterProxy >> receivedNextAll: aNameCollection with: anArgument [ aNameCollection do: [ :each | diff --git a/src/XML-Writer-Tests/XMLWriterTest.class.st b/src/XML-Writer-Tests/XMLWriterTest.class.st index f55ed53..8396b45 100644 --- a/src/XML-Writer-Tests/XMLWriterTest.class.st +++ b/src/XML-Writer-Tests/XMLWriterTest.class.st @@ -3,12 +3,14 @@ A simple test case class. Please add more tests to it! " Class { - #name : #XMLWriterTest, - #superclass : #TestCase, - #category : #'XML-Writer-Tests-Tests' + #name : 'XMLWriterTest', + #superclass : 'TestCase', + #category : 'XML-Writer-Tests-Tests', + #package : 'XML-Writer-Tests', + #tag : 'Tests' } -{ #category : #private } +{ #category : 'private' } XMLWriterTest class >> onCanonicalLineBreakJoin: aLineCollection [ ^ self @@ -16,7 +18,7 @@ XMLWriterTest class >> onCanonicalLineBreakJoin: aLineCollection [ join: aLineCollection ] -{ #category : #private } +{ #category : 'private' } XMLWriterTest class >> onLineBreak: aCharacterOrString join: aLineCollection [ | printedFirstLine | @@ -30,19 +32,19 @@ XMLWriterTest class >> onLineBreak: aCharacterOrString join: aLineCollection [ stream nextPutAll: each ] ] ] -{ #category : #private } +{ #category : 'private' } XMLWriterTest >> onCanonicalLineBreakJoin: aLineCollection [ ^ self class onCanonicalLineBreakJoin: aLineCollection ] -{ #category : #private } +{ #category : 'private' } XMLWriterTest >> onLineBreak: aCharacterOrString join: aLineCollection [ ^ self class onLineBreak: aCharacterOrString join: aLineCollection ] -{ #category : #private } +{ #category : 'private' } XMLWriterTest >> prettyPrintedLines: anArrayOfLineArrays [ "Takes an array of arrays where the first element of each is the indent level and the rest are the lines with that indent level" @@ -65,7 +67,7 @@ XMLWriterTest >> prettyPrintedLines: anArrayOfLineArrays [ stream nextPutAll: (each at: lineIndex) ] ] ] ] -{ #category : #asserting } +{ #category : 'asserting' } XMLWriterTest >> should: aBlock enumerate: aCollection [ | enumerated | @@ -74,7 +76,7 @@ XMLWriterTest >> should: aBlock enumerate: aCollection [ self assert: enumerated equals: aCollection asOrderedCollection ] -{ #category : #tests } +{ #category : 'tests' } XMLWriterTest >> testActiveMarkupWriterAncestorsDo [ | writer enumerated oneTagWriter twoTagWriter threeTagWriter | @@ -121,7 +123,7 @@ XMLWriterTest >> testActiveMarkupWriterAncestorsDo [ enumerate: enumerated ] -{ #category : #tests } +{ #category : 'tests' } XMLWriterTest >> testActiveMarkupWriterParent [ | writer xmlDeclarationWriter tagWriter | @@ -154,7 +156,7 @@ XMLWriterTest >> testActiveMarkupWriterParent [ assert: (writer parentOfMarkupWriter: tagWriter) isNil ] -{ #category : #tests } +{ #category : 'tests' } XMLWriterTest >> testActiveMarkupWriterWithAncestorsDo [ | writer enumerated oneTagWriter twoTagWriter threeTagWriter | @@ -209,7 +211,7 @@ XMLWriterTest >> testActiveMarkupWriterWithAncestorsDo [ enumerate: enumerated ] -{ #category : #tests } +{ #category : 'tests' } XMLWriterTest >> testActiveTagWriter [ | writer tagWriter | @@ -238,7 +240,7 @@ XMLWriterTest >> testActiveTagWriter [ self assert: writer activeTagWriter isNil ] -{ #category : #tests } +{ #category : 'tests' } XMLWriterTest >> testAsString [ self assert: @@ -252,7 +254,7 @@ XMLWriterTest >> testAsString [ tag: 'two') asString equals: '' ] -{ #category : #tests } +{ #category : 'tests' } XMLWriterTest >> testAtBeginning [ "on GS #writeStream gives an ANSI 0-based position stream, but WriteStream on: doesn't, so both are tested, and we @@ -272,7 +274,7 @@ XMLWriterTest >> testAtBeginning [ self deny: writer atBeginning] ] -{ #category : #tests } +{ #category : 'tests' } XMLWriterTest >> testAttributes [ | writer tag | @@ -299,7 +301,7 @@ XMLWriterTest >> testAttributes [ 'test' ] -{ #category : #tests } +{ #category : 'tests' } XMLWriterTest >> testCDataSections [ | writer | @@ -323,7 +325,7 @@ XMLWriterTest >> testCDataSections [ '') ] -{ #category : #'tests - canonical' } +{ #category : 'tests - canonical' } XMLWriterTest >> testCanonicalComments [ | writer | @@ -355,7 +357,7 @@ XMLWriterTest >> testCanonicalComments [ '')) ] -{ #category : #'tests - canonical' } +{ #category : 'tests - canonical' } XMLWriterTest >> testCanonicalDTDs [ | writer | @@ -397,7 +399,7 @@ XMLWriterTest >> testCanonicalDTDs [ '')) ] -{ #category : #'tests - canonical' } +{ #category : 'tests - canonical' } XMLWriterTest >> testCanonicalEscaping [ | writer tag | @@ -420,7 +422,7 @@ XMLWriterTest >> testCanonicalEscaping [ '<>"''&' ] -{ #category : #'tests - canonical' } +{ #category : 'tests - canonical' } XMLWriterTest >> testCanonicalEscapingWhitespace [ | whitespace writer tag | @@ -447,7 +449,7 @@ XMLWriterTest >> testCanonicalEscapingWhitespace [ format: whitespace) ] -{ #category : #'tests - canonical' } +{ #category : 'tests - canonical' } XMLWriterTest >> testCanonicalNonRedundantXMLNSDeclarations [ | withBlock | @@ -483,7 +485,7 @@ XMLWriterTest >> testCanonicalNonRedundantXMLNSDeclarations [ '') ] -{ #category : #'tests - canonical' } +{ #category : 'tests - canonical' } XMLWriterTest >> testCanonicalPIs [ | writer | @@ -521,7 +523,7 @@ XMLWriterTest >> testCanonicalPIs [ '')) ] -{ #category : #'tests - canonical' } +{ #category : 'tests - canonical' } XMLWriterTest >> testCanonicalRedundantXMLNSDeclarations [ | withBlock | @@ -559,7 +561,7 @@ XMLWriterTest >> testCanonicalRedundantXMLNSDeclarations [ contents) equals: '' ] -{ #category : #'tests - canonical' } +{ #category : 'tests - canonical' } XMLWriterTest >> testCanonicalTags [ | writer | @@ -592,7 +594,7 @@ XMLWriterTest >> testCanonicalTags [ '') ] -{ #category : #'tests - canonical' } +{ #category : 'tests - canonical' } XMLWriterTest >> testCanonicalXMLDeclarationsAndPIs [ | writer | @@ -617,7 +619,7 @@ XMLWriterTest >> testCanonicalXMLDeclarationsAndPIs [ '')) ] -{ #category : #tests } +{ #category : 'tests' } XMLWriterTest >> testClose [ self assert: @@ -633,7 +635,7 @@ XMLWriterTest >> testClose [ tag: 'two') close]) equals: '' ] -{ #category : #tests } +{ #category : 'tests' } XMLWriterTest >> testContentEntityReferenceEscaping [ self assert: @@ -655,7 +657,7 @@ XMLWriterTest >> testContentEntityReferenceEscaping [ '<"&four;">' ] -{ #category : #tests } +{ #category : 'tests' } XMLWriterTest >> testContentEscaping [ | writer | @@ -680,7 +682,7 @@ XMLWriterTest >> testContentEscaping [ self assert: writer contents equals: '" unescaped="& " < >">& " < >' ] -{ #category : #tests } +{ #category : 'tests' } XMLWriterTest >> testContents [ self assert: @@ -694,7 +696,7 @@ XMLWriterTest >> testContents [ tag: 'two') contents equals: '' ] -{ #category : #tests } +{ #category : 'tests' } XMLWriterTest >> testEmbedInMarkupWriter [ (Array @@ -728,7 +730,7 @@ XMLWriterTest >> testEmbedInMarkupWriter [ with: each]) equals: ''] ] -{ #category : #tests } +{ #category : 'tests' } XMLWriterTest >> testEnablePlatformSpecificLineBreak [ | writer | @@ -738,7 +740,7 @@ XMLWriterTest >> testEnablePlatformSpecificLineBreak [ assert: writer lineBreak equals: writer platformSpecificLineBreak ] -{ #category : #tests } +{ #category : 'tests' } XMLWriterTest >> testEnablePrettyPrinting [ | writer | @@ -797,7 +799,7 @@ XMLWriterTest >> testEnablePrettyPrinting [ #(0 ''))) ] -{ #category : #tests } +{ #category : 'tests' } XMLWriterTest >> testEnablePrettyPrintingDTD [ | writer | @@ -851,7 +853,7 @@ XMLWriterTest >> testEnablePrettyPrintingDTD [ ''))) ] -{ #category : #tests } +{ #category : 'tests' } XMLWriterTest >> testEnablePrologPrettyPrinting [ | writer | @@ -932,7 +934,7 @@ XMLWriterTest >> testEnablePrologPrettyPrinting [ ''))) ] -{ #category : #tests } +{ #category : 'tests' } XMLWriterTest >> testEntityDeclaration [ | writer | @@ -972,7 +974,7 @@ XMLWriterTest >> testEntityDeclaration [ ']>') ] -{ #category : #tests } +{ #category : 'tests' } XMLWriterTest >> testEntityReference [ | writer | @@ -987,7 +989,7 @@ XMLWriterTest >> testEntityReference [ self assert: writer contents equals: '&one;two&three;' ] -{ #category : #tests } +{ #category : 'tests' } XMLWriterTest >> testEntityValueEscaping [ | writer | @@ -1008,7 +1010,7 @@ XMLWriterTest >> testEntityValueEscaping [ self assert: writer contents equals: '">' ] -{ #category : #tests } +{ #category : 'tests' } XMLWriterTest >> testEscapesContentEntityReferences [ | writer | @@ -1043,7 +1045,7 @@ XMLWriterTest >> testEscapesContentEntityReferences [ equals: writer contentStringDefaultEscapes ] -{ #category : #'tests - formatting' } +{ #category : 'tests - formatting' } XMLWriterTest >> testFormatter [ | writer formatter | @@ -1060,7 +1062,7 @@ XMLWriterTest >> testFormatter [ assert: writer formatter isNil ] -{ #category : #'tests - formatting' } +{ #category : 'tests - formatting' } XMLWriterTest >> testFormattingAttributeDeclarations [ | formatter writer doctypeWriter firstDeclarationWriter secondDeclarationWriter thirdDeclarationWriter | @@ -1184,7 +1186,7 @@ XMLWriterTest >> testFormattingAttributeDeclarations [ ']>') ] -{ #category : #'tests - formatting' } +{ #category : 'tests - formatting' } XMLWriterTest >> testFormattingContent [ | formatter writer tagWriter commentWriter entityRefWriter | @@ -1301,7 +1303,7 @@ XMLWriterTest >> testFormattingContent [ '') ] -{ #category : #'tests - formatting' } +{ #category : 'tests - formatting' } XMLWriterTest >> testFormattingElementDeclarations [ | formatter writer doctypeWriter firstDeclarationWriter secondDeclarationWriter thirdDeclarationWriter fourthDeclarationWriter | @@ -1415,7 +1417,7 @@ XMLWriterTest >> testFormattingElementDeclarations [ ']>') ] -{ #category : #'tests - formatting' } +{ #category : 'tests - formatting' } XMLWriterTest >> testFormattingEntityDelcarations [ | formatter writer doctypeWriter firstDeclarationWriter secondDeclarationWriter thirdDeclarationWriter fourthDeclarationWriter | @@ -1549,7 +1551,7 @@ XMLWriterTest >> testFormattingEntityDelcarations [ ']>') ] -{ #category : #'tests - formatting' } +{ #category : 'tests - formatting' } XMLWriterTest >> testFormattingPIs [ | formatter writer piWriter | @@ -1671,7 +1673,7 @@ XMLWriterTest >> testFormattingPIs [ '') ] -{ #category : #'tests - formatting' } +{ #category : 'tests - formatting' } XMLWriterTest >> testFormattingProlog [ | formatter writer xmlDeclarationWriter doctypeWriter | @@ -1770,7 +1772,7 @@ XMLWriterTest >> testFormattingProlog [ '') ] -{ #category : #'tests - formatting' } +{ #category : 'tests - formatting' } XMLWriterTest >> testFormattingUnsafeTagWriters [ | formatter writer tagWriter | @@ -1829,7 +1831,7 @@ XMLWriterTest >> testFormattingUnsafeTagWriters [ '' ] -{ #category : #tests } +{ #category : 'tests' } XMLWriterTest >> testHadActiveTagWriter [ | writer tagWriter | @@ -1847,7 +1849,7 @@ XMLWriterTest >> testHadActiveTagWriter [ self assert: writer hadActiveTagWriter ] -{ #category : #tests } +{ #category : 'tests' } XMLWriterTest >> testHasActiveTagWriter [ | writer tagWriter | @@ -1877,7 +1879,7 @@ XMLWriterTest >> testHasActiveTagWriter [ self deny: writer hasActiveTagWriter ] -{ #category : #tests } +{ #category : 'tests' } XMLWriterTest >> testHasFormatter [ | writer | @@ -1892,7 +1894,7 @@ XMLWriterTest >> testHasFormatter [ self deny: writer hasFormatter ] -{ #category : #tests } +{ #category : 'tests' } XMLWriterTest >> testIsCanonical [ | writer | @@ -1933,7 +1935,7 @@ XMLWriterTest >> testIsCanonical [ assert: writer omitsRedundantXMLNSDeclarations ] -{ #category : #tests } +{ #category : 'tests' } XMLWriterTest >> testLineBreak [ (Array @@ -1956,7 +1958,7 @@ XMLWriterTest >> testLineBreak [ ''))] ] -{ #category : #tests } +{ #category : 'tests' } XMLWriterTest >> testNonRedundantXMLNSDeclarations [ | withBlock | @@ -1991,7 +1993,7 @@ XMLWriterTest >> testNonRedundantXMLNSDeclarations [ '') ] -{ #category : #tests } +{ #category : 'tests' } XMLWriterTest >> testOmitsRedundantXMLNSDeclarations [ | withBlock | @@ -2045,7 +2047,7 @@ XMLWriterTest >> testOmitsRedundantXMLNSDeclarations [ '' ] -{ #category : #tests } +{ #category : 'tests' } XMLWriterTest >> testOnFormatter [ | stream formatter writer | @@ -2057,7 +2059,7 @@ XMLWriterTest >> testOnFormatter [ assert: writer formatter identicalTo: formatter ] -{ #category : #tests } +{ #category : 'tests' } XMLWriterTest >> testOutputsSelfClosingTags [ | writer | @@ -2076,7 +2078,7 @@ XMLWriterTest >> testOutputsSelfClosingTags [ '' ] -{ #category : #tests } +{ #category : 'tests' } XMLWriterTest >> testPIsWithStringValues [ | writer | @@ -2106,7 +2108,7 @@ XMLWriterTest >> testPIsWithStringValues [ '') ] -{ #category : #tests } +{ #category : 'tests' } XMLWriterTest >> testRaw [ self assert: @@ -2122,7 +2124,7 @@ XMLWriterTest >> testRaw [ with: [writer raw: '']]) equals: '' ] -{ #category : #tests } +{ #category : 'tests' } XMLWriterTest >> testRedundantWrites [ self assert: @@ -2152,7 +2154,7 @@ XMLWriterTest >> testRedundantWrites [ '') ] -{ #category : #tests } +{ #category : 'tests' } XMLWriterTest >> testSimpleExample [ | writer | @@ -2165,7 +2167,7 @@ XMLWriterTest >> testSimpleExample [ self assert: writer contents equals: '' ] -{ #category : #tests } +{ #category : 'tests' } XMLWriterTest >> testSimpleExampleWithWriteWith [ | block contents | @@ -2181,7 +2183,7 @@ XMLWriterTest >> testSimpleExampleWithWriteWith [ assert: (XMLWriter writeWith: block) equals: contents ] -{ #category : #tests } +{ #category : 'tests' } XMLWriterTest >> testStartingAndFinishing [ | writer outer inner | @@ -2208,7 +2210,7 @@ XMLWriterTest >> testStartingAndFinishing [ 'test' ] -{ #category : #tests } +{ #category : 'tests' } XMLWriterTest >> testString [ self assert: @@ -2224,7 +2226,7 @@ XMLWriterTest >> testString [ with: [writer string: '']]) equals: '' ] -{ #category : #tests } +{ #category : 'tests' } XMLWriterTest >> testSystemAndPublicIDs [ | writer | @@ -2239,7 +2241,7 @@ XMLWriterTest >> testSystemAndPublicIDs [ self assert: writer contents equals: '' ] -{ #category : #tests } +{ #category : 'tests' } XMLWriterTest >> testUnsafeTagWriters [ self assert: @@ -2258,7 +2260,7 @@ XMLWriterTest >> testUnsafeTagWriters [ endTag: 'one']) equals: '' ] -{ #category : #tests } +{ #category : 'tests' } XMLWriterTest >> testUnsafeTagWritersAttributes [ | writer tag | @@ -2283,7 +2285,7 @@ XMLWriterTest >> testUnsafeTagWritersAttributes [ '' ] -{ #category : #tests } +{ #category : 'tests' } XMLWriterTest >> testUnsafeTagWritersXMLNSDeclarations [ | writer tag | @@ -2316,7 +2318,7 @@ XMLWriterTest >> testUnsafeTagWritersXMLNSDeclarations [ '' ] -{ #category : #tests } +{ #category : 'tests' } XMLWriterTest >> testWideStringContent [ | wideStringContent writer | @@ -2346,7 +2348,7 @@ XMLWriterTest >> testWideStringContent [ format: (Array with: wideStringContent)) ] -{ #category : #tests } +{ #category : 'tests' } XMLWriterTest >> testXMLDeclarations [ | writer | @@ -2388,7 +2390,7 @@ XMLWriterTest >> testXMLDeclarations [ '') ] -{ #category : #tests } +{ #category : 'tests' } XMLWriterTest >> testXMLNSDeclarations [ | writer tag | diff --git a/src/XML-Writer-Tests/package.st b/src/XML-Writer-Tests/package.st index f5b0839..7104a1b 100644 --- a/src/XML-Writer-Tests/package.st +++ b/src/XML-Writer-Tests/package.st @@ -1 +1 @@ -Package { #name : #'XML-Writer-Tests' } +Package { #name : 'XML-Writer-Tests' }