Skip to content

Commit

Permalink
Cleanup: deprecate #notEmpty and use #isNotEmpty
Browse files Browse the repository at this point in the history
Fix #26
  • Loading branch information
astares committed Oct 25, 2023
1 parent bf564b4 commit 2f63cbb
Show file tree
Hide file tree
Showing 33 changed files with 103 additions and 63 deletions.
2 changes: 1 addition & 1 deletion src/XML-Parser-Tests/XMLDFALimitsTest.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ XMLDFALimitsTest >> testDFAStateCacheLimit [
ifFalse: [
visitedStates do: [:each | self deny: each dfaStateTransitions isEmpty].
self
assert: firstState dfaStateTransitions notEmpty;
assert: firstState dfaStateTransitions isNotEmpty;
assert: firstState dfaStateCache cachedDFAStates size equals: (i + 1);
deny: currentState isAccepting]].

Expand Down
6 changes: 3 additions & 3 deletions src/XML-Parser-Tests/XMLDOMParserTest.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ XMLDOMParserTest >> testAttributeNamespaces [

document := XMLDOMParser parse: self addressBookNamespacePrefixedXML.
people := document allElementsNamed: 'person' namespaceURI: 'personNS'.
self assert: people notEmpty.
self assert: people isNotEmpty.

people do: [:each |
self
Expand All @@ -96,7 +96,7 @@ XMLDOMParserTest >> testAttributeNamespacesDisabled [
parse: self addressBookNamespacePrefixedXML
usingNamespaces: false.
people := document allElementsNamed: 'person'.
self assert: people notEmpty.
self assert: people isNotEmpty.
people do: [:each |
self
assert: each hasAttributes;
Expand Down Expand Up @@ -295,7 +295,7 @@ XMLDOMParserTest >> testDoctypeDeclaration [
assert: doctype root equals: 'root';
assert: doctype publicID equals: 'pubid';
assert: doctype systemID equals: 'external.dtd';
assert: doctype nodes notEmpty;
assert: doctype nodes isNotEmpty;
assert: (doctype nodes allSatisfy: [:each | each isDeclaration])
]

Expand Down
6 changes: 3 additions & 3 deletions src/XML-Parser-Tests/XMLElementTest.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -710,7 +710,7 @@ XMLElementTest >> testDefaultNamespace [
| element elementsWithDefaultNamespace |
element := self newNodeWithElements.
elementsWithDefaultNamespace := element allElementsSelect: [ :each |
each defaultNamespace notEmpty ].
each defaultNamespace isNotEmpty ].
self
assert: (element defaultNamespace: 'newDefaultNS')
identicalTo: element.
Expand Down Expand Up @@ -1673,7 +1673,7 @@ XMLElementTest >> testUndeclareDefaultNamespace [
descendantElementsSelect: [
:each |
each defaultNamespace
notEmpty and: [
isNotEmpty and: [
each defaultNamespace
~= oldRootDefaultNamespace ] ].

Expand All @@ -1684,7 +1684,7 @@ XMLElementTest >> testUndeclareDefaultNamespace [
(elementsWithCustomDefaultNamespace includes: each)
ifTrue: [
self
assert: each defaultNamespace notEmpty;
assert: each defaultNamespace isNotEmpty;
deny: each defaultNamespace equals: oldRootDefaultNamespace;
deny: each defaultNamespace equals: 'newDefaultNS' ]
ifFalse: [ self assert: each defaultNamespace isEmpty ] ].
Expand Down
2 changes: 1 addition & 1 deletion src/XML-Parser-Tests/XMLHTTPMessageTest.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ XMLHTTPMessageTest >> testHasHeaders [
self isSupported ifFalse: [ ^ self ].

message := self newMessage.
self assert: message hasHeaders equals: message headers notEmpty.
self assert: message hasHeaders equals: message headers isNotEmpty.

message removeHeaders.
self deny: message hasHeaders.
Expand Down
4 changes: 2 additions & 2 deletions src/XML-Parser-Tests/XMLKeyValueCacheTest.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -357,8 +357,8 @@ XMLKeyValueCacheTest >> testMaxSize [
{ #category : #tests }
XMLKeyValueCacheTest >> testNotEmpty [
self
deny: self newCache notEmpty;
assert: self newCacheWithEntries notEmpty
deny: self newCache isNotEmpty;
assert: self newCacheWithEntries isNotEmpty
]

{ #category : #tests }
Expand Down
2 changes: 1 addition & 1 deletion src/XML-Parser-Tests/XMLMessageRecorder.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ XMLMessageRecorder >> clearMessages [

{ #category : #testing }
XMLMessageRecorder >> hasMessages [
^ self messageQueue notEmpty
^ self messageQueue isNotEmpty
]

{ #category : #private }
Expand Down
6 changes: 3 additions & 3 deletions src/XML-Parser-Tests/XMLNodeWithElementsTest.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ XMLNodeWithElementsTest >> testAcceptNodeVisitor [
detect: [ :each | node perform: each first ]
ifNone: [ #( nil #( ) ) ]) second.

self assert: visitingSelectors notEmpty.
self assert: visitingSelectors isNotEmpty.
visitingSelectors do: [ :selector |
self assert: visitor messageRecorder hasMessages.

Expand Down Expand Up @@ -1641,7 +1641,7 @@ XMLNodeWithElementsTest >> testHasContentNodes [
nodeWithElements allElementsDo: [ :element |
self
assert: element hasContentNodes
equals: element contentNodes notEmpty ]
equals: element contentNodes isNotEmpty ]
]

{ #category : #tests }
Expand All @@ -1661,7 +1661,7 @@ XMLNodeWithElementsTest >> testHasStringNodes [
nodeWithElements allElementsDo: [ :element |
self
assert: element hasStringNodes
equals: element stringNodes notEmpty ]
equals: element stringNodes isNotEmpty ]
]

{ #category : #tests }
Expand Down
6 changes: 3 additions & 3 deletions src/XML-Parser-Tests/XMLStringTest.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -301,13 +301,13 @@ XMLStringTest >> testNotEmpty [
| node |

node := self newNode.
self deny: node notEmpty.
self deny: node isNotEmpty.

node string: ' '.
self assert: node notEmpty.
self assert: node isNotEmpty.

node string: ''.
self deny: node notEmpty
self deny: node isNotEmpty
]

{ #category : #tests }
Expand Down
16 changes: 8 additions & 8 deletions src/XML-Parser-Tests/XMLURITest.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -1671,23 +1671,23 @@ XMLURITest >> testNotEmpty [

self allURIStringsDo: [:each |
uri := each asXMLURI.
each notEmpty
ifTrue: [self assert: uri notEmpty]
ifFalse: [self deny: uri notEmpty].
each isNotEmpty
ifTrue: [self assert: uri isNotEmpty]
ifFalse: [self deny: uri isNotEmpty].

uri
parseURIStringIfUnparsed;
uriString: nil.
each notEmpty
ifTrue: [self assert: uri notEmpty]
ifFalse: [self deny: uri notEmpty]].
each isNotEmpty
ifTrue: [self assert: uri isNotEmpty]
ifFalse: [self deny: uri isNotEmpty]].

uri := '//:?#' asXMLURI.
self deny: uri notEmpty.
self deny: uri isNotEmpty.
uri
parseURIStringIfUnparsed;
uriString: nil.
self deny: uri notEmpty.
self deny: uri isNotEmpty.
]

{ #category : #tests }
Expand Down
10 changes: 5 additions & 5 deletions src/XML-Parser/DTDDoctypeDefinition.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@ DTDDoctypeDefinition >> hasGeneralEntities [
"direct access to avoid lazy initialization"

^ generalEntities notNil
and: [generalEntities notEmpty]
and: [generalEntities isNotEmpty]
]

{ #category : #testing }
Expand All @@ -383,27 +383,27 @@ DTDDoctypeDefinition >> hasNotationAttributeValidators [
DTDDoctypeDefinition >> hasNotations [
"direct access to avoid lazy initialization"

^ notations notNil and: [ notations notEmpty ]
^ notations notNil and: [ notations isNotEmpty ]
]

{ #category : #testing }
DTDDoctypeDefinition >> hasParameterEntities [
"direct access to avoid lazy initialization"

^ parameterEntities notNil and: [ parameterEntities notEmpty ]
^ parameterEntities notNil and: [ parameterEntities isNotEmpty ]
]

{ #category : #testing }
DTDDoctypeDefinition >> hasRoot [

^ root notNil and: [ root notEmpty ]
^ root notNil and: [ root isNotEmpty ]
]

{ #category : #testing }
DTDDoctypeDefinition >> hasUnparsedEntities [
"direct access to avoid lazy initialization"

^ unparsedEntities notNil and: [ unparsedEntities notEmpty ]
^ unparsedEntities notNil and: [ unparsedEntities isNotEmpty ]
]

{ #category : #'instance creation' }
Expand Down
2 changes: 1 addition & 1 deletion src/XML-Parser/DTDExternalParsedEntity.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ DTDExternalParsedEntity class >> name: aName resolver: aResolver publicID: aPubl
{ #category : #testing }
DTDExternalParsedEntity >> hasReplacement [

^ self resolvedReplacement notEmpty
^ self resolvedReplacement isNotEmpty
]

{ #category : #testing }
Expand Down
2 changes: 1 addition & 1 deletion src/XML-Parser/DTDInternalParsedEntity.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ DTDInternalParsedEntity class >> name: aName replacement: aReplacementString uri
{ #category : #testing }
DTDInternalParsedEntity >> hasReplacement [

^ self replacement notEmpty
^ self replacement isNotEmpty
]

{ #category : #accessing }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,21 @@ DTDResolvedExternalParsedEntityReplacement >> isEmpty [
]

{ #category : #testing }
DTDResolvedExternalParsedEntityReplacement >> notEmpty [
DTDResolvedExternalParsedEntityReplacement >> isNotEmpty [

^ self isEmpty not
]

{ #category : #testing }
DTDResolvedExternalParsedEntityReplacement >> notEmpty [

self
deprecated: 'Please use #isNotEmpty instead.'
transformWith: '`@receiver notEmpty' -> '`@receiver isNotEmpty'.

^ self isNotEmpty
]

{ #category : #accessing }
DTDResolvedExternalParsedEntityReplacement >> readStream [

Expand Down
2 changes: 1 addition & 1 deletion src/XML-Parser/DTDStaticExternalEntityResolver.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ DTDStaticExternalEntityResolver >> externalEntityAtURI: anXMLURIOrURIString put:
{ #category : #testing }
DTDStaticExternalEntityResolver >> hasExternalEntities [

^ self externalEntities notEmpty
^ self externalEntities isNotEmpty
]

{ #category : #testing }
Expand Down
2 changes: 1 addition & 1 deletion src/XML-Parser/XMLAttribute.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ XMLAttribute >> expandedName [

{ #category : #testing }
XMLAttribute >> hasNamespaceURI [
^ self namespaceURI notEmpty
^ self namespaceURI isNotEmpty
]

{ #category : #testing }
Expand Down
2 changes: 1 addition & 1 deletion src/XML-Parser/XMLAttributeDictionary.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ XMLAttributeDictionary >> namespaceURIOf: aKey [
| prefix |

^ (self usesNamespaces
and: [(prefix := aKey xmlPrefixBeforeLocalName) notEmpty])
and: [(prefix := aKey xmlPrefixBeforeLocalName) isNotEmpty])
ifTrue: [self resolvePrefix: prefix]
ifFalse: ['']
]
Expand Down
4 changes: 2 additions & 2 deletions src/XML-Parser/XMLCachingNodeList.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ XMLCachingNodeList >> firstElement [

{ #category : #testing }
XMLCachingNodeList >> hasElements [
^ cachedElements notNil and: [cachedElements notEmpty]
^ cachedElements notNil and: [cachedElements isNotEmpty]
]

{ #category : #testing }
Expand Down Expand Up @@ -285,7 +285,7 @@ XMLCachingNodeList >> renamedElement: anElement from: anOldName to: aNewName [
self
cachedElementsByNameAt: anOldName
remove: anElement.
(oldPrefix := anOldName xmlPrefixBeforeLocalName) notEmpty
(oldPrefix := anOldName xmlPrefixBeforeLocalName) isNotEmpty
ifTrue: [
self
cachedElementsByNameAt: (anOldName xmlLocalNameAfterPrefix: oldPrefix)
Expand Down
2 changes: 1 addition & 1 deletion src/XML-Parser/XMLDocument.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ XMLDocument >> hasDoctypeDefinition [

{ #category : #testing }
XMLDocument >> hasEncoding [
^ self encoding notEmpty
^ self encoding isNotEmpty
]

{ #category : #testing }
Expand Down
2 changes: 1 addition & 1 deletion src/XML-Parser/XMLElement.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -413,7 +413,7 @@ XMLElement >> hasID: anID [

{ #category : #testing }
XMLElement >> hasNamespaceURI [
^ self namespaceURI notEmpty
^ self namespaceURI isNotEmpty
]

{ #category : #testing }
Expand Down
4 changes: 2 additions & 2 deletions src/XML-Parser/XMLElementIDValidator.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,13 @@ XMLElementIDValidator >> errorUnknownIDReference: anID [
{ #category : #testing }
XMLElementIDValidator >> hasIDReferences [
^ idReferences notNil
and: [idReferences notEmpty]
and: [idReferences isNotEmpty]
]

{ #category : #testing }
XMLElementIDValidator >> hasIDs [
^ ids notNil
and: [ids notEmpty]
and: [ids isNotEmpty]
]

{ #category : #accessing }
Expand Down
4 changes: 2 additions & 2 deletions src/XML-Parser/XMLEntityDeclaration.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ XMLEntityDeclaration class >> name: aName replacement: aReplacement [

{ #category : #testing }
XMLEntityDeclaration >> isExternal [
^ self systemID notEmpty
or: [self publicID notEmpty]
^ self systemID isNotEmpty
or: [self publicID isNotEmpty]
]

{ #category : #testing }
Expand Down
2 changes: 1 addition & 1 deletion src/XML-Parser/XMLGeneralEntityDeclaration.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ XMLGeneralEntityDeclaration class >> name: aName publicID: aPublicID systemID: a

{ #category : #testing }
XMLGeneralEntityDeclaration >> isUnparsed [
^ self ndata notEmpty
^ self ndata isNotEmpty
]

{ #category : #accessing }
Expand Down
2 changes: 1 addition & 1 deletion src/XML-Parser/XMLHTTPMIMETypeParser.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ XMLHTTPMIMETypeParser >> parseParameters [
peekFor: $=)
ifTrue: [value := self nextTokenOrQuotedString]
ifFalse: [value := ''].
(attribute notEmpty
(attribute isNotEmpty
or: [hasValue])
ifTrue: [
"only initialize if needed"
Expand Down
2 changes: 1 addition & 1 deletion src/XML-Parser/XMLHTTPMessage.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ XMLHTTPMessage >> errorRemovingAbsentHeader: aKey [

{ #category : #testing }
XMLHTTPMessage >> hasContent [
^ self content notEmpty
^ self content isNotEmpty
]

{ #category : #testing }
Expand Down
2 changes: 1 addition & 1 deletion src/XML-Parser/XMLHTTPResponseContentReader.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ XMLHTTPResponseContentReader >> readUpToLimit: arg1 decoding: arg2 [
rawContent := self rawReadWithLength: tmp1 upToLimit: arg1.
contentReadStream := rawContent readStream.
(self handlesDecompression and: [
(tmp3 := response contentEncoding) notEmpty ]) ifTrue: [
(tmp3 := response contentEncoding) isNotEmpty ]) ifTrue: [
self initializeDecompressionWithSchemes: tmp3 upToLimit: arg1 ].
(arg2 and: [
(tmp2 := response contentType) notNil and: [
Expand Down
Loading

0 comments on commit 2f63cbb

Please sign in to comment.