Opened 3 years ago

Closed 13 months ago

#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
    }

Change History (1)

comment:1 Changed 13 months ago by asmirnov

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

The tests are rewritten, the issue is deprecated.

Note: See TracTickets for help on using tickets.