Closed Bug 575379 Opened 9 years ago Closed 9 years ago

jsapi-test for JSClass::getProperty


(Core :: JavaScript Engine, enhancement)

Not set





(Reporter: wes, Unassigned)




(1 file)

This is a trivial test based on bl's problem in #jsapi today.
Attachment #454608 - Attachment is patch: true
Attachment #454608 - Attachment mime type: application/octet-stream → text/plain
Attachment #454608 - Flags: review?(jorendorff)
What was bl's problem? Isn't it better addressed by docs, since there's no code fix to the engine that this jsapi-test QAs?

bl's problem was in fact user error - but I didn't realize that when I initially wrote the test.

Figured I'd post the test case as a "take if you want it" - not sure what jsapi-test's longer-term goals are, if they are only to watch regressions or to someday provide individual API coverage exercise. 

Sorry for the crappy description, I forgot the wider audience.
Comment on attachment 454608 [details] [diff] [review]
Test program and relevent tweak

I'll take a test if I can get it, any day.

In jsapi-tests/
>   testNewObject.cpp \
>   testOps.cpp \
>   testPropCache.cpp \
>   testTrap.cpp \
>   testSameValue.cpp \
>   testSeal.cpp \
>   testXDR.cpp \
>   testSetPropertyWithNativeGetterStubSetter.cpp \
>+  testClassGetter.cpp \

Please put the last two into alphabetical order with the rest.

>+ * Tests the JSClass get hook

"JSClass::getProperty hook", please.

>+static struct {
>+    int test_fn;
>+    int test_prop_get;
>+} called;

Just make two variables.

>+    CHECK(definePrint());

Delete this line.


By convention these test names are filename_testname, so this should be testClassGetter_isCalled or something.

>+        CHECK_SAME(INT_TO_JSVAL(i), INT_TO_JSVAL(called.test_fn));
>+        CHECK_SAME(INT_TO_JSVAL(4 * i), INT_TO_JSVAL(called.test_prop_get));

The order of arguments to CHECK_SAME is (actual, expected). So swap them.

r=me with those changes; if you have a chance, please make the changes and then commit and push this to tracemonkey. Thanks!
Attachment #454608 - Flags: review?(jorendorff) → review+
Summary: jsapi-test for JSClass::get → jsapi-test for JSClass::getProperty
Closed: 9 years ago
Resolution: --- → FIXED
Depends on: 603364
You need to log in before you can comment on or make changes to this bug.