Opened on 06/21/2016 at 01:56:22 PM

Closed on 10/23/2018 at 10:19:48 AM

#4178 closed change (rejected)

Create JsTest.testFunctionValue test

Reported by: asmirnov Assignee: asmirnov
Priority: P3 Milestone:
Module: Libadblockplus-Android Keywords:
Cc: rjeschke Blocked By:
Blocking: #4031 Platform: Android
Ready: yes Confidential: no
Tester: Unknown Verified working: no
Review URL(s):

Description

Due to missing JsValue.call() it's impossible to do the test similar to ​​https://hg.adblockplus.org/libadblockplus/file/tip/test/JsValue.cpp#l186.

smth like:

@Test
    public void testFunctionValue()
    {
        JsValue value = jsEngine.evaluate(
            "(function(foo, bar) {return this.x + '/' + foo + '/' + bar;})");
        assertFalse(value.isUndefined());
        assertFalse(value.isNull());
        assertFalse(value.isString());
        assertFalse(value.isBoolean());
        assertFalse(value.isNumber());
        assertTrue(value.isObject());
        assertFalse(value.isArray());
        assertTrue(value.isFunction());
        assertTrue(value.asBoolean());
        try
        {
            value.asList();
            fail(AdblockPlusException.class.getSimpleName() + " is expected to be thrown");
        } catch (AdblockPlusException e)
        {
            // ignored
        }
        assertEquals(2l, value.getProperty("length").asLong());

        JsValue thisValue = jsEngine.evaluate("({x:2})");
        List<JsValue> params = new ArrayList<JsValue>();
        params.add(jsEngine.newValue(5l));
        params.add(jsEngine.newValue("xyz"));

        // TODO : finish when method jsValue.call() is created
    }

Attachments (0)

Change History (1)

comment:1 Changed on 10/23/2018 at 10:19:48 AM by asmirnov

  • Resolution set to rejected
  • Status changed from new to closed

The tests are rewritten, the issue is deprecated.

Add Comment

Modify Ticket

Change Properties
Action
as closed .
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from asmirnov.
 
Note: See TracTickets for help on using tickets.