Skip to content

Commit

Permalink
FIx printOn: message.
Browse files Browse the repository at this point in the history
Guessing `sql` in the original message referes to source, because that's what the sql: setter message uses.
  • Loading branch information
lopezca committed Mar 3, 2024
1 parent e3dd84e commit ca5544d
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 ca5544d

Please sign in to comment.