Skip to content

Commit

Permalink
Merge pull request #5 from svenvc/master
Browse files Browse the repository at this point in the history
P3FormattedStatement printOn: fix
  • Loading branch information
svenvc authored Mar 7, 2024
2 parents 29d48c2 + 769ed55 commit 16c4cc5
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 16c4cc5

Please sign in to comment.