rt/emul/compacttest/src/test/java/org/apidesign/bck2brwsr/tck/BooleanTest.java
author Jaroslav Tulach <jaroslav.tulach@apidesign.org>
Fri, 10 Jun 2016 05:52:44 +0200
branchLibraries
changeset 1971 de609e0cdab5
parent 1787 rt/emul/compacttest/src/test/java/org/apidesign/bck2brwsr/tck/CharacterTest.java@ea12a3bb4b33
permissions -rw-r--r--
Make sure Boolean.prototype contains the Java methods soon enough
jaroslav@296
     1
/**
jaroslav@296
     2
 * Back 2 Browser Bytecode Translator
jaroslav@1787
     3
 * Copyright (C) 2012-2015 Jaroslav Tulach <jaroslav.tulach@apidesign.org>
jaroslav@296
     4
 *
jaroslav@296
     5
 * This program is free software: you can redistribute it and/or modify
jaroslav@296
     6
 * it under the terms of the GNU General Public License as published by
jaroslav@296
     7
 * the Free Software Foundation, version 2 of the License.
jaroslav@296
     8
 *
jaroslav@296
     9
 * This program is distributed in the hope that it will be useful,
jaroslav@296
    10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
jaroslav@296
    11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
jaroslav@296
    12
 * GNU General Public License for more details.
jaroslav@296
    13
 *
jaroslav@296
    14
 * You should have received a copy of the GNU General Public License
jaroslav@296
    15
 * along with this program. Look for COPYING file in the top folder.
jaroslav@296
    16
 * If not, see http://opensource.org/licenses/GPL-2.0.
jaroslav@296
    17
 */
jaroslav@346
    18
package org.apidesign.bck2brwsr.tck;
jaroslav@296
    19
jaroslav@1971
    20
import net.java.html.js.JavaScriptBody;
jaroslav@1971
    21
import org.apidesign.bck2brwsr.vmtest.BrwsrTest;
jaroslav@346
    22
import org.apidesign.bck2brwsr.vmtest.VMTest;
jaroslav@296
    23
import org.testng.annotations.Factory;
jaroslav@296
    24
jaroslav@1971
    25
public class BooleanTest {
jaroslav@1971
    26
    @JavaScriptBody(args = {  }, body = "return true;")
jaroslav@1971
    27
    private static native Boolean getTrue();
jaroslav@1971
    28
jaroslav@1971
    29
    @JavaScriptBody(args = {  }, body = "return false;")
jaroslav@1971
    30
    private static native Boolean getFalse();
jaroslav@1971
    31
jaroslav@1971
    32
    @BrwsrTest public void primitiveTrue() {
jaroslav@1971
    33
        boolean t = getTrue();
jaroslav@1971
    34
        assert t : "Yes, it is true";
jaroslav@1384
    35
    }
jaroslav@1384
    36
jaroslav@1971
    37
    @BrwsrTest public void primitiveFalse() {
jaroslav@1971
    38
        boolean t = getFalse();
jaroslav@1971
    39
        assert !t : "Yes, it is false";
jaroslav@1384
    40
    }
jaroslav@1384
    41
jaroslav@296
    42
    @Factory
jaroslav@296
    43
    public static Object[] create() {
jaroslav@1971
    44
        return VMTest.create(BooleanTest.class);
jaroslav@296
    45
    }
jaroslav@328
    46
jaroslav@296
    47
}