diff --git a/src/Stash-Serialization-Tests/StashTest.class.st b/src/Stash-Serialization-Tests/StashTest.class.st index b2e6f89..54ad037 100644 --- a/src/Stash-Serialization-Tests/StashTest.class.st +++ b/src/Stash-Serialization-Tests/StashTest.class.st @@ -387,6 +387,24 @@ StashTest >> testString1 [ self assert: source equals: '''hello''' ] +{ #category : #tests } +StashTest >> testString10 [ + + | object source | + object := #toto. + source := Stash new serialize: object. + self assert: source equals: '#toto' +] + +{ #category : #tests } +StashTest >> testString11 [ + + | object source | + object := #'toto-titi'. + source := Stash new serialize: object. + self assert: source equals: '#''toto-titi''' +] + { #category : #tests } StashTest >> testString2 [ diff --git a/src/Stash-Serialization/String.extension.st b/src/Stash-Serialization/String.extension.st index 6d1da3a..f5751e8 100644 --- a/src/Stash-Serialization/String.extension.st +++ b/src/Stash-Serialization/String.extension.st @@ -6,6 +6,7 @@ String >> asStashObject [ | correctedString | correctedString := self copyReplaceAll: '%' with: '%%'. correctedString := correctedString copyReplaceAll: '<' with: '%<'. + self isSymbol ifTrue: [ correctedString := correctedString asSymbol ]. ^ StashObject new object: correctedString; yourself