How to test functions within Javascriptcore?
问题 I have seen many examples where someone takes a JavaScript function and evaluates it by doing something like: JSContext *context = [[JSContext alloc] initWithVirtualMachine:[[JSVirtualMachine alloc] init]]; [context evaluateScript:@"var add = function(a, b) {return a + b;}"]; NSLog(@"%@", [context[@"add"] callWithArguments:@[@20, @30]]); //Output is 50 But how can we run test cases on the function? By calling arguments we can see the result (assuming it doesn't throw an exception). In the