numbas / Numbas

A completely browser-based e-assessment/e-learning system, with an emphasis on mathematics
http://www.numbas.org.uk
Apache License 2.0
200 stars 118 forks source link

Check the returned values of custom javascript functions #861

Closed christianp closed 1 year ago

christianp commented 2 years ago

We had a custom JS function which produced a list of lists of numbers, but said it was returning a vector. The wrapper round custom javascript functions created in the question context (not built-ins or those added by extensions) should check that the returned value has the declared type.

christianp commented 1 year ago

I think this is fixed by making TVector (and TMatrix while I'm thinking about this) check that the value it's given has the right type.