author | Jaroslav Tulach <jaroslav.tulach@apidesign.org> |
Sat, 26 Apr 2014 19:13:56 +0200 | |
branch | closure |
changeset 1489 | 8d0fc428ff72 |
parent 1097 | 8e42a376da73 |
child 1491 | 4a1398eff4fb |
permissions | -rw-r--r-- |
jaroslav@1097 | 1 |
/** |
jaroslav@1097 | 2 |
* Back 2 Browser Bytecode Translator |
jaroslav@1097 | 3 |
* Copyright (C) 2012 Jaroslav Tulach <jaroslav.tulach@apidesign.org> |
jaroslav@1097 | 4 |
* |
jaroslav@1097 | 5 |
* This program is free software: you can redistribute it and/or modify |
jaroslav@1097 | 6 |
* it under the terms of the GNU General Public License as published by |
jaroslav@1097 | 7 |
* the Free Software Foundation, version 2 of the License. |
jaroslav@1097 | 8 |
* |
jaroslav@1097 | 9 |
* This program is distributed in the hope that it will be useful, |
jaroslav@1097 | 10 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
jaroslav@1097 | 11 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
jaroslav@1097 | 12 |
* GNU General Public License for more details. |
jaroslav@1097 | 13 |
* |
jaroslav@1097 | 14 |
* You should have received a copy of the GNU General Public License |
jaroslav@1097 | 15 |
* along with this program. Look for COPYING file in the top folder. |
jaroslav@1097 | 16 |
* If not, see http://opensource.org/licenses/GPL-2.0. |
jaroslav@1097 | 17 |
*/ |
jaroslav@1097 | 18 |
package org.apidesign.bck2brwsr.brwsrtest; |
jaroslav@1097 | 19 |
|
jaroslav@1097 | 20 |
import org.apidesign.bck2brwsr.core.JavaScriptBody; |
jaroslav@1097 | 21 |
import org.apidesign.bck2brwsr.vmtest.BrwsrTest; |
jaroslav@1097 | 22 |
import org.apidesign.bck2brwsr.vmtest.VMTest; |
jaroslav@1097 | 23 |
import org.testng.annotations.Factory; |
jaroslav@1097 | 24 |
|
jaroslav@1097 | 25 |
/** |
jaroslav@1097 | 26 |
* |
jaroslav@1097 | 27 |
* @author Jaroslav Tulach <jtulach@netbeans.org> |
jaroslav@1097 | 28 |
*/ |
jaroslav@1489 | 29 |
@org.apidesign.bck2brwsr.core.Exported |
jaroslav@1097 | 30 |
public class BooleanTest { |
jaroslav@1097 | 31 |
@JavaScriptBody(args = { "tr" }, body = "return tr ? true : false;") |
jaroslav@1097 | 32 |
private static native Object trueFalse(boolean tr); |
jaroslav@1097 | 33 |
|
jaroslav@1097 | 34 |
@BrwsrTest public void isTrueInstanceOfBoolean() { |
jaroslav@1097 | 35 |
Object t = trueFalse(true); |
jaroslav@1097 | 36 |
assert t instanceof Boolean : "Should be boolean: " + t; |
jaroslav@1097 | 37 |
assert ((boolean)t) : "and is true"; |
jaroslav@1097 | 38 |
} |
jaroslav@1097 | 39 |
|
jaroslav@1097 | 40 |
@BrwsrTest public void isFalseInstanceOfBoolean() { |
jaroslav@1097 | 41 |
Object t = trueFalse(false); |
jaroslav@1097 | 42 |
assert t instanceof Boolean : "Should be boolean: " + t; |
jaroslav@1097 | 43 |
assert !((boolean)t) : "and is false: " + t; |
jaroslav@1097 | 44 |
} |
jaroslav@1097 | 45 |
|
jaroslav@1097 | 46 |
@Factory public static Object[] create() { |
jaroslav@1097 | 47 |
return VMTest.create(BooleanTest.class); |
jaroslav@1097 | 48 |
} |
jaroslav@1097 | 49 |
} |