Skip to content

Commit

Permalink
Fix over 2000 lint issues in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
astares committed Oct 24, 2023
1 parent 646621b commit 6bf4669
Show file tree
Hide file tree
Showing 58 changed files with 6,421 additions and 6,364 deletions.
55 changes: 36 additions & 19 deletions src/XML-Parser-Tests/DTDExternalEntityResolverTest.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ DTDExternalEntityResolverTest >> resolverClass [

{ #category : #tests }
DTDExternalEntityResolverTest >> testCopy [

| resolver copy |
(resolver := self newResolver)
externalSubsetReadLimit: 1000000;
Expand All @@ -46,18 +47,23 @@ DTDExternalEntityResolverTest >> testCopy [
resolvesLocalFromNonLocal: true.
copy := resolver copy.
self
deny: copy == resolver;
deny: copy identicalTo: resolver;
assert: copy externalSubsetReadLimit equals: 1000000;
assert: copy maxExternalEntities equals: 10;
assert: copy maxExternalEntitySize equals: 10000;
assert: copy resolvesLocalFromNonLocal.

self isTestingLimiting
ifTrue: [ self
assert: copy externalEntityResolver == resolver externalEntityResolver;
assert: copy externalEntityLimits == resolver externalEntityLimits ]
ifFalse: [ self
deny: copy externalEntityLimits == resolver externalEntityLimits ]
ifTrue: [
self
assert: copy externalEntityResolver
identicalTo: resolver externalEntityResolver;
assert: copy externalEntityLimits
identicalTo: resolver externalEntityLimits ]
ifFalse: [
self
deny: copy externalEntityLimits
identicalTo: resolver externalEntityLimits ]
]

{ #category : #tests }
Expand All @@ -81,54 +87,63 @@ DTDExternalEntityResolverTest >> testDecoratorInterfaceCompatibility [

{ #category : #tests }
DTDExternalEntityResolverTest >> testExternalEntityLimits [
| resolver newEntityLimits |

| resolver newEntityLimits |
resolver := self newResolver.
self assert: resolver externalEntityLimits class == self entityLimitsClass.
self
assert: resolver externalEntityLimits class
identicalTo: self entityLimitsClass.

newEntityLimits := self newEntityLimits.
self
assert: (resolver externalEntityLimits: newEntityLimits) == resolver;
assert: resolver externalEntityLimits == newEntityLimits
assert: (resolver externalEntityLimits: newEntityLimits)
identicalTo: resolver;
assert: resolver externalEntityLimits identicalTo: newEntityLimits
]

{ #category : #tests }
DTDExternalEntityResolverTest >> testExternalSubsetReadLimit [

| resolver |
resolver := self newResolver.
self
assert: resolver externalSubsetReadLimit
equals: DTDExternalEntityLimits defaultExternalSubsetReadLimit.
self
assert: (resolver externalSubsetReadLimit: 1000000) == resolver;
assert: (resolver externalSubsetReadLimit: 1000000)
identicalTo: resolver;
assert: resolver externalSubsetReadLimit equals: 1000000;
assert: (resolver externalSubsetReadLimit: nil) == resolver;
assert: (resolver externalSubsetReadLimit: nil)
identicalTo: resolver;
assert: resolver externalSubsetReadLimit isNil
]

{ #category : #tests }
DTDExternalEntityResolverTest >> testMaxExternalEntities [

| resolver |
resolver := self newResolver.
self
assert: resolver maxExternalEntities > 0;
assert: (resolver maxExternalEntities: 10) == resolver;
assert: (resolver maxExternalEntities: 10) identicalTo: resolver;
assert: resolver maxExternalEntities equals: 10;
assert: (resolver maxExternalEntities: nil) == resolver;
assert: (resolver maxExternalEntities: nil) identicalTo: resolver;
assert: resolver maxExternalEntities isNil
]

{ #category : #tests }
DTDExternalEntityResolverTest >> testMaxExternalEntitySize [

| resolver |
resolver := self newResolver.
self
assert: resolver maxExternalEntitySize
equals: DTDExternalEntityLimits defaultMaxExternalEntitySize.
self
assert: (resolver maxExternalEntitySize: 10000) == resolver;
assert: (resolver maxExternalEntitySize: 10000)
identicalTo: resolver;
assert: resolver maxExternalEntitySize equals: 10000;
assert: (resolver maxExternalEntitySize: nil) == resolver;
assert: (resolver maxExternalEntitySize: nil) identicalTo: resolver;
assert: resolver maxExternalEntitySize isNil
]

Expand Down Expand Up @@ -158,14 +173,16 @@ DTDExternalEntityResolverTest >> testRemoveLimits [

{ #category : #tests }
DTDExternalEntityResolverTest >> testResolvesLocalFromNonLocal [
| resolver |

| resolver |
resolver := self newResolver.
self
deny: resolver resolvesLocalFromNonLocal;
assert: (resolver resolvesLocalFromNonLocal: false) == resolver;
assert: (resolver resolvesLocalFromNonLocal: false)
identicalTo: resolver;
deny: resolver resolvesLocalFromNonLocal;
assert: (resolver resolvesLocalFromNonLocal: true) == resolver;
assert: (resolver resolvesLocalFromNonLocal: true)
identicalTo: resolver;
assert: resolver resolvesLocalFromNonLocal
]

Expand Down
29 changes: 14 additions & 15 deletions src/XML-Parser-Tests/DTDStaticExternalEntityResolverTest.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -49,39 +49,39 @@ DTDStaticExternalEntityResolverTest >> resolverClass [

{ #category : #tests }
DTDStaticExternalEntityResolverTest >> testCopy [

| resolver copy |
super testCopy.
self isTestingLimiting
ifTrue: [ ^ self ].
self isTestingLimiting ifTrue: [ ^ self ].
resolver := self newResolverWithEntities.
copy := resolver copy.
self
deny: copy == resolver;
deny: copy externalEntities == resolver externalEntities;
deny: copy identicalTo: resolver;
deny: copy externalEntities identicalTo: resolver externalEntities;
assert: copy externalEntities equals: resolver externalEntities
]

{ #category : #tests }
DTDStaticExternalEntityResolverTest >> testExternalEntities [

| resolver replacementAssociation |
self isTestingLimiting
ifTrue: [ ^ self ].
self isTestingLimiting ifTrue: [ ^ self ].
resolver := self newResolver.
self
assert: resolver externalEntities class == Dictionary;
assert: resolver externalEntities class identicalTo: Dictionary;
assert: resolver externalEntities isEmpty.
resolver externalEntities: self entityAssociations.
self assert: resolver externalEntities equals: self entityDictionary.
replacementAssociation := 'new.ent' asXMLURI
-> self newEntityReplacement.
-> self newEntityReplacement.
resolver externalEntities: (Array with: replacementAssociation).
self
assert: resolver externalEntities
equals: (Dictionary with: replacementAssociation).
resolver := self resolverClass
externalEntities: self entityAssociations.
resolver := self resolverClass externalEntities:
self entityAssociations.
self
assert: resolver class == self resolverClass;
assert: resolver class identicalTo: self resolverClass;
assert: resolver externalEntities equals: self entityDictionary
]

Expand Down Expand Up @@ -217,14 +217,13 @@ DTDStaticExternalEntityResolverTest >> testIncludesExternalEntityURI [

{ #category : #tests }
DTDStaticExternalEntityResolverTest >> testRemoveExternalEntities [
| resolver |

self isTestingLimiting
ifTrue: [^ self].
| resolver |
self isTestingLimiting ifTrue: [ ^ self ].

resolver := self newResolverWithEntities.
self
assert: resolver removeExternalEntities == resolver;
assert: resolver removeExternalEntities identicalTo: resolver;
deny: resolver hasExternalEntities
]

Expand Down
43 changes: 23 additions & 20 deletions src/XML-Parser-Tests/SAX2ElementHandlerParserTest.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -90,33 +90,36 @@ SAX2ElementHandlerParserTest >> testParsingSamplePerson [

| person rootFactory personFactory contactsFactory factoryMapper |
rootFactory := SAX2PluggableElementHandlerFactory new
handleElement: 'person'
withClass: SAX2HPersonElementHandler.
handleElement: 'person'
withClass: SAX2HPersonElementHandler.
personFactory := SAX2PluggableElementHandlerFactory new
handleElement: 'name' withClass: SAX2HNameElementHandler;
handleElement: 'date-of-birth'
withClass: SAX2HDateOfBirthElementHandler;
handleElement: 'contacts' withClass: SAX2HContactsElementHandler;
handleElement: 'residence' withClass: SAX2HResidenceElementHandler.
handleElement: 'name'
withClass: SAX2HNameElementHandler;
handleElement: 'date-of-birth'
withClass: SAX2HDateOfBirthElementHandler;
handleElement: 'contacts'
withClass: SAX2HContactsElementHandler;
handleElement: 'residence'
withClass: SAX2HResidenceElementHandler.
contactsFactory := SAX2PluggableElementHandlerFactory new
handleElement: 'email'
withClass: SAX2HEmailElementHandler.
handleElement: 'email'
withClass: SAX2HEmailElementHandler.
factoryMapper := SAX2PluggableElementHandlerFactoryMapper new
mapElementHandlerClass: SAX2HPersonElementHandler
toFactory: personFactory;
mapElementHandlerClass: SAX2HContactsElementHandler
toFactory: contactsFactory.
mapElementHandlerClass: SAX2HPersonElementHandler
toFactory: personFactory;
mapElementHandlerClass: SAX2HContactsElementHandler
toFactory: contactsFactory.
person := (SAX2ElementParser on: self samplePersonXML)
elementHandlerFactory: rootFactory;
elementHandlerFactoryMapper: factoryMapper;
parseDocument.
elementHandlerFactory: rootFactory;
elementHandlerFactoryMapper: factoryMapper;
parseDocument.
self
assert: person class == SAX2SamplePerson;
assert: person class identicalTo: SAX2SamplePerson;
assert: person name equals: 'Tim Bray';
assert: person dateOfBirth
equals: (Date year: 1955 month: 6 day: 21);
equals: (Date year: 1955 month: 6 day: 21);
assert: person emailAddresses asArray
equals: #('[email protected]' '[email protected]');
equals: #( '[email protected]' '[email protected]' );
assert: person residence
equals: 'Vancouver, British Columbia, Canada'
equals: 'Vancouver, British Columbia, Canada'
]
Loading

0 comments on commit 6bf4669

Please sign in to comment.