From e616f2ee41031f68b2314d9cb658fa8155b12e4a Mon Sep 17 00:00:00 2001 From: Yann Le Goff Date: Tue, 29 Jul 2025 17:26:10 +0200 Subject: [PATCH] Fix symbol with String --- .../StashTest.class.st | 18 ++++++++++++++++++ src/Stash-Serialization/String.extension.st | 1 + 2 files changed, 19 insertions(+) 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