sjbarag / brs

An interpreter for the BrightScript language that runs on non-Roku platforms.
MIT License
113 stars 43 forks source link

Implement mock return type #624

Open lkipke opened 3 years ago

lkipke commented 3 years ago

Summary

(Coming from a discussion in #622)

Currently our mock functions have a results property, which is just a flat array of return values from each call. Now that Brightscript supports try/catch, our mock functions should align to Jest's implementation, where each result in the results array is an object that looks like:

{ type: "throw" | "return", value: <return value> }

Note that this will be a breaking change for mock functions.