stacktrace test
This commit is contained in:
		
							parent
							
								
									2d0e6432cd
								
							
						
					
					
						commit
						8cbbdf5489
					
				|  | @ -78,3 +78,33 @@ describe("test exceptions", () => { | |||
|   //   "Error(TODO: unhandled rescript exception)", | ||||
|   // ) | ||||
| }) | ||||
| 
 | ||||
| describe("stacktraces", () => { | ||||
|   test("nested calls", () => { | ||||
|     open Expect | ||||
| 
 | ||||
|     let error = | ||||
|       Expression.BackCompatible.evaluateString(` | ||||
|   f(x) = { | ||||
|     y = "a" | ||||
|     x + y | ||||
|   } | ||||
|   g = {|x| f(x)} | ||||
|   h(x) = g(x) | ||||
|   h(5) | ||||
| `) | ||||
|       ->E.R.getError | ||||
|       ->E.O2.toExn("oops") | ||||
|       ->SqError.toStringWithStackTrace | ||||
| 
 | ||||
|     expect( | ||||
|       error, | ||||
|     )->toBe(`Error: There are function matches for add(), but with different arguments: [add(number, number)]; [add(distribution, number)]; [add(number, distribution)]; [add(distribution, distribution)]; [add(date, duration)]; [add(duration, duration)] | ||||
| Stack trace: | ||||
|   f at line 4, column 5 | ||||
|   <anonymous> at line 6, column 12 | ||||
|   h at line 7, column 10 | ||||
|   <top> at line 8, column 3 | ||||
| `) | ||||
|   }) | ||||
| }) | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue
	
	Block a user