~ubuntu-branches/ubuntu/vivid/emscripten/vivid

« back to all changes in this revision

Viewing changes to tests/embind/embind.test.js

  • Committer: Package Import Robot
  • Author(s): Sylvestre Ledru
  • Date: 2013-09-20 22:44:35 UTC
  • mfrom: (4.1.1 sid)
  • Revision ID: package-import@ubuntu.com-20130920224435-apuwj4fsl3fqv1a6
Tags: 1.5.6~20130920~6010666-1
* New snapshot release
* Update the list of supported architectures to the same as libv8
  (Closes: #723129)
* emlibtool has been removed from upstream.
* Fix warning syntax-error-in-dep5-copyright
* Refresh of the patches

Show diffs side-by-side

added added

removed removed

Lines of Context:
898
898
 
899
899
        test("can clone handles", function() {
900
900
            var a = cm.emval_test_get_function_ptr();
901
 
            assert.equal(1, a.$$.count.value);
902
901
            var b = a.clone();
903
 
            assert.equal(2, a.$$.count.value);
904
 
            assert.equal(2, b.$$.count.value);
905
902
            a.delete();
906
903
 
907
904
            assert.throws(cm.BindingError, function() {
1149
1146
            a.set(b);
1150
1147
            var c = a.get();
1151
1148
 
1152
 
            assert.equal(b.$$.ptr, c.$$.ptr);
 
1149
            assert.true(b.isAliasOf(c));
1153
1150
            b.delete();
1154
1151
            c.delete();
1155
1152
            a.delete();
1747
1744
    BaseFixture.extend("constants", function() {
1748
1745
        assert.equal(10, cm.INT_CONSTANT);
1749
1746
        assert.equal("some string", cm.STRING_CONSTANT);
1750
 
        assert.deepEqual([1, 2, 3, 4], cm.VALUE_TUPLE_CONSTANT);
1751
 
        assert.deepEqual({x:1,y:2,z:3,w:4}, cm.VALUE_STRUCT_CONSTANT);
 
1747
        assert.deepEqual([1, 2, 3, 4], cm.VALUE_ARRAY_CONSTANT);
 
1748
        assert.deepEqual({x:1,y:2,z:3,w:4}, cm.VALUE_OBJECT_CONSTANT);
1752
1749
    });
1753
1750
 
1754
1751
    BaseFixture.extend("object handle comparison", function() {
1881
1878
        //     setTimeout(fn, 0);
1882
1879
        // });
1883
1880
    });
 
1881
 
 
1882
    BaseFixture.extend("references", function() {
 
1883
        test("JS object handles can be passed through to C++ by reference", function() {
 
1884
            var sh = new cm.StringHolder("Hello world");
 
1885
            assert.equal("Hello world", sh.get());
 
1886
            cm.clear_StringHolder(sh);
 
1887
            assert.equal("", sh.get());
 
1888
            sh.delete();
 
1889
        });
 
1890
    });
1884
1891
});
1885
1892
 
1886
1893
/* global run_all_tests */