@@ -230,12 +230,54 @@ func runScalarsTests(t *testing.T, executor DBOSContext) {
230230 })
231231}
232232
233+ // testRoundTrip doesn't work super well for pointer types and ListWorkflows/GetWorkflowSteps
233234func runPointerTests (t * testing.T , executor DBOSContext ) {
234235 t .Run ("Pointers" , func (t * testing.T ) {
235236 v := 123
236- h2 , err := RunWorkflow (executor , serializerIntPtrWorkflow , & v )
237+ expected := & v
238+ h2 , err := RunWorkflow (executor , serializerIntPtrWorkflow , expected )
237239 require .NoError (t , err )
238- testRoundTrip [* int , * int ](t , executor , h2 , & v )
240+
241+ t .Run ("HandleGetResult" , func (t * testing.T ) {
242+ gotAny , err := h2 .GetResult ()
243+ require .NoError (t , err )
244+ assert .Equal (t , expected , gotAny )
245+ })
246+
247+ t .Run ("RetrieveWorkflow" , func (t * testing.T ) {
248+ h3 , err := RetrieveWorkflow [* int ](executor , h2 .GetWorkflowID ())
249+ require .NoError (t , err )
250+ gotAny , err := h3 .GetResult ()
251+ require .NoError (t , err )
252+ assert .Equal (t , expected , gotAny )
253+ })
254+
255+ // For ListWorkflows and GetWorkflowSteps, the decoded value will be the underlying type,
256+ // not the pointer, because they use serializer.Decode() without pointer reconstruction
257+ t .Run ("ListWorkflows" , func (t * testing.T ) {
258+ wfs , err := ListWorkflows (executor ,
259+ WithWorkflowIDs ([]string {h2 .GetWorkflowID ()}),
260+ WithLoadInput (true ), WithLoadOutput (true ))
261+ require .NoError (t , err )
262+ require .Len (t , wfs , 1 )
263+ wf := wfs [0 ]
264+ require .NotNil (t , wf .Input )
265+ require .NotNil (t , wf .Output )
266+ // Decoded value should be the underlying type (int), not the pointer
267+ assert .Equal (t , v , wf .Input , "Input should be dereferenced value" )
268+ assert .Equal (t , v , wf .Output , "Output should be dereferenced value" )
269+ })
270+
271+ t .Run ("GetWorkflowSteps" , func (t * testing.T ) {
272+ steps , err := GetWorkflowSteps (executor , h2 .GetWorkflowID ())
273+ require .NoError (t , err )
274+ require .Len (t , steps , 1 )
275+ step := steps [0 ]
276+ require .NotNil (t , step .Output )
277+ // Decoded value should be the underlying type (int), not the pointer
278+ assert .Equal (t , v , step .Output , "Step output should be dereferenced value" )
279+ assert .Nil (t , step .Error )
280+ })
239281 })
240282}
241283
0 commit comments