Skip to content

Commit

Permalink
Merge pull request #50 from panalcloud/fix-printOn
Browse files Browse the repository at this point in the history
Fix printOn: message.
  • Loading branch information
svenvc authored Mar 4, 2024
2 parents e3dd84e + ca5544d commit 769ed55
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
18 changes: 18 additions & 0 deletions P3-Tests/P3FormattedStatementTest.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,24 @@ P3FormattedStatementTest >> testNull [
client execute: 'DROP TABLE table1'
]

{ #category : #tests }
P3FormattedStatementTest >> testPrintOn [
"client format: returns a P3FormattedStatement. Use result to test printOn:"

| sql p3fs result|

sql := 'INSERT INTO table1 (id, name) VALUES ($1, $2)'.

p3fs := client format: sql.

result := String streamContents: [ :stream | p3fs printOn: stream ].

self assert: result contents equals: ('a P3FormattedStatement({1})' format: { sql })



]

{ #category : #tests }
P3FormattedStatementTest >> testSimple [
| statement result |
Expand Down
2 changes: 1 addition & 1 deletion P3/P3FormattedStatement.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ P3FormattedStatement >> printObject: object on: stream [
{ #category : #printing }
P3FormattedStatement >> printOn: stream [
super printOn: stream.
stream nextPut: $(; << sql; nextPut: $)
stream nextPut: $(; << source; nextPut: $)
]
{ #category : #'printing-dispatched' }
Expand Down

0 comments on commit 769ed55

Please sign in to comment.