jsapi-test for JSClass::getProperty

RESOLVED FIXED

Status

()

Core
JavaScript Engine
--
enhancement
RESOLVED FIXED
7 years ago
7 years ago

People

(Reporter: Wesley W. Garland, Unassigned)

Tracking

Trunk
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

(Reporter)

Description

7 years ago
Created attachment 454608 [details] [diff] [review]
Test program and relevent Makefile.in tweak

This is a trivial test based on bl's problem in #jsapi today.
(Reporter)

Updated

7 years ago
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?

/be
(Reporter)

Comment 2

7 years ago
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 Makefile.in tweak

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

In jsapi-tests/Makefile.in:
>   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.

>+BEGIN_TEST(testClassGetter)
[...]
>+END_TEST(testClassGetter)

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

Comment 4

7 years ago
http://hg.mozilla.org/mozilla-central/rev/8bd8dc9407cc
Status: NEW → RESOLVED
Last Resolved: 7 years ago
Resolution: --- → FIXED

Updated

7 years ago
Depends on: 603364
You need to log in before you can comment on or make changes to this bug.