@@ -77,48 +77,76 @@ let B = /* @__PURE__ */Primitive_exceptions.create("Record_extension_test.B");
7777
7878let C = /* @__PURE__ */ Primitive_exceptions . create ( "Record_extension_test.C" ) ;
7979
80+ let D = /* @__PURE__ */ Primitive_exceptions . create ( "Record_extension_test.D" ) ;
81+
8082function u ( f ) {
8183 try {
8284 return f ( ) ;
8385 } catch ( raw_x ) {
8486 let x = Primitive_exceptions . internalToException ( raw_x ) ;
8587 if ( x . RE_EXN_ID === A ) {
8688 return x . name + x . x | 0 ;
87- } else if ( x . RE_EXN_ID === B ) {
89+ }
90+ if ( x . RE_EXN_ID === B ) {
8891 return x . _1 + x . _2 | 0 ;
89- } else if ( x . RE_EXN_ID === C ) {
92+ }
93+ if ( x . RE_EXN_ID === C ) {
9094 return x . name ;
91- } else {
95+ }
96+ if ( x . RE_EXN_ID !== D ) {
9297 return - 1 ;
9398 }
99+ let message = x . message ;
100+ let code = x . code ;
101+ if ( message !== undefined ) {
102+ return code + message . length | 0 ;
103+ } else {
104+ return code ;
105+ }
94106 }
95107}
96108
97- Mocha . describe ( "File \"record_extension_test.res\", line 68 , characters 9-16" , ( ) => {
109+ Mocha . describe ( "File \"record_extension_test.res\", line 71 , characters 9-16" , ( ) => {
98110 Mocha . test ( "record extension with exceptions" , ( ) => {
99- Test_utils . eq ( "File \"record_extension_test.res\", line 70 , characters 7-14" , u ( ( ) => {
111+ Test_utils . eq ( "File \"record_extension_test.res\", line 73 , characters 7-14" , u ( ( ) => {
100112 throw {
101113 RE_EXN_ID : A ,
102114 name : 1 ,
103115 x : 1 ,
104116 Error : new Error ( )
105117 } ;
106118 } ) , 2 ) ;
107- Test_utils . eq ( "File \"record_extension_test.res\", line 71 , characters 7-14" , u ( ( ) => {
119+ Test_utils . eq ( "File \"record_extension_test.res\", line 74 , characters 7-14" , u ( ( ) => {
108120 throw {
109121 RE_EXN_ID : B ,
110122 _1 : 1 ,
111123 _2 : 2 ,
112124 Error : new Error ( )
113125 } ;
114126 } ) , 3 ) ;
115- Test_utils . eq ( "File \"record_extension_test.res\", line 72 , characters 7-14" , u ( ( ) => {
127+ Test_utils . eq ( "File \"record_extension_test.res\", line 75 , characters 7-14" , u ( ( ) => {
116128 throw {
117129 RE_EXN_ID : C ,
118130 name : 4 ,
119131 Error : new Error ( )
120132 } ;
121133 } ) , 4 ) ;
134+ Test_utils . eq ( "File \"record_extension_test.res\", line 76, characters 7-14" , u ( ( ) => {
135+ throw {
136+ RE_EXN_ID : D ,
137+ code : 1 ,
138+ message : "A" ,
139+ Error : new Error ( )
140+ } ;
141+ } ) , 2 ) ;
142+ Test_utils . eq ( "File \"record_extension_test.res\", line 77, characters 7-14" , u ( ( ) => {
143+ throw {
144+ RE_EXN_ID : D ,
145+ code : 3 ,
146+ message : undefined ,
147+ Error : new Error ( )
148+ } ;
149+ } ) , 3 ) ;
122150 } ) ;
123151} ) ;
124152
@@ -132,6 +160,7 @@ export {
132160 A ,
133161 B ,
134162 C ,
163+ D ,
135164 u ,
136165}
137166/* Not a pure module */
0 commit comments