@@ -523,17 +523,18 @@ defmodule TransactionTest do
523523 P . transaction ( pool , fn _ -> flunk ( "transaction ran" ) end )
524524 end
525525
526- prefix =
527- "client #{ inspect ( self ( ) ) } stopped: " <>
528- "** (DBConnection.ConnectionError) bad return value: :oops"
529-
530- len = byte_size ( prefix )
526+ pid_str = inspect ( self ( ) )
531527
532528 assert_receive { :EXIT , ^ conn ,
533529 { % DBConnection.ConnectionError {
534- message: << ^ prefix :: binary - size ( len ) , _ :: binary >>
530+ message: message
535531 } , [ _ | _ ] } }
536532
533+ assert Regex . match? (
534+ ~r/ ^client #{ Regex . escape ( pid_str ) } (?<optional_pid_info>\s *\( [^)]+\) )?\s +stopped: \* \* \( DBConnection\. ConnectionError\) bad return value: :oops/ ,
535+ message
536+ )
537+
537538 assert [
538539 { :connect , _ } ,
539540 { :handle_begin , [ _ , :state ] } ,
@@ -567,14 +568,18 @@ defmodule TransactionTest do
567568 P . transaction ( pool , fn _ -> flunk ( "transaction ran" ) end )
568569 end
569570
570- prefix = "client #{ inspect ( self ( ) ) } stopped: ** (RuntimeError) oops"
571- len = byte_size ( prefix )
571+ pid_str = inspect ( self ( ) )
572572
573573 assert_receive { :EXIT , ^ conn ,
574574 { % DBConnection.ConnectionError {
575- message: << ^ prefix :: binary - size ( len ) , _ :: binary >>
575+ message: message
576576 } , [ _ | _ ] } }
577577
578+ assert Regex . match? (
579+ ~r/ ^client #{ Regex . escape ( pid_str ) } (?<optional_pid_info>\s *\( [^)]+\) )?\s +stopped: \* \* \( RuntimeError\) oops/ ,
580+ message
581+ )
582+
578583 assert [
579584 { :connect , _ } ,
580585 { :handle_begin , [ _ , :state ] } ,
@@ -709,17 +714,18 @@ defmodule TransactionTest do
709714 P . transaction ( pool , fn _ -> :result end )
710715 end
711716
712- prefix =
713- "client #{ inspect ( self ( ) ) } stopped: " <>
714- "** (DBConnection.ConnectionError) bad return value: :oops"
715-
716- len = byte_size ( prefix )
717+ pid_str = inspect ( self ( ) )
717718
718719 assert_receive { :EXIT , ^ conn ,
719720 { % DBConnection.ConnectionError {
720- message: << ^ prefix :: binary - size ( len ) , _ :: binary >>
721+ message: message
721722 } , [ _ | _ ] } }
722723
724+ assert Regex . match? (
725+ ~r/ ^client #{ Regex . escape ( pid_str ) } (?<optional_pid_info>\s *\( [^)]+\) )?\s +stopped: \* \* \( DBConnection\. ConnectionError\) bad return value: :oops/ ,
726+ message
727+ )
728+
723729 assert [
724730 { :connect , _ } ,
725731 { :handle_begin , [ _ , :state ] } ,
@@ -752,14 +758,18 @@ defmodule TransactionTest do
752758 Process . flag ( :trap_exit , true )
753759 assert_raise RuntimeError , "oops" , fn -> P . transaction ( pool , fn _ -> :result end ) end
754760
755- prefix = "client #{ inspect ( self ( ) ) } stopped: ** (RuntimeError) oops"
756- len = byte_size ( prefix )
761+ pid_str = inspect ( self ( ) )
757762
758763 assert_receive { :EXIT , ^ conn ,
759764 { % DBConnection.ConnectionError {
760- message: << ^ prefix :: binary - size ( len ) , _ :: binary >>
765+ message: message
761766 } , [ _ | _ ] } }
762767
768+ assert Regex . match? (
769+ ~r/ ^client #{ Regex . escape ( pid_str ) } (?<optional_pid_info>\s *\( [^)]+\) )?\s +stopped: \* \* \( RuntimeError\) oops/ ,
770+ message
771+ )
772+
763773 assert [
764774 { :connect , _ } ,
765775 { :handle_begin , [ _ , :state ] } ,
0 commit comments