Permalink
Browse files

Uncomment ternary complex tests

  • Loading branch information...
ovr committed Jun 2, 2015
1 parent 456a45d commit ff7bff19a4605906406078a31bd972fe5f9afa40
Showing with 33 additions and 21 deletions.
  1. +13 −2 ext/test/ternary.zep.c
  2. +14 −14 test/ternary.zep
  3. +6 −5 unit-tests/Extension/TernaryTest.php

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
@@ -12,10 +12,10 @@ class Ternary
return 100 ? true + 100 : false;
}
public function testTernary2(boolean b)
{
return b ? "foo" : "bar";
}
public function testTernary2(boolean b)
{
return b ? "foo" : "bar";
}
public function testTernaryComplex1(var a, var y)
{
@@ -29,7 +29,7 @@ class Ternary
public function testTernaryComplex3(var a)
{
//return gettype(typeof a == "resource" ? "unknown": false);
return gettype(typeof a == "resource" ? "unknown": false);
}
/**
@@ -46,13 +46,13 @@ class Ternary
return var3;
}
/**
* @link https://github.com/phalcon/zephir/issues/297
*/
public function testTernaryAfterLetVariable()
{
var s = 23;
let s = 1===1 ? 3 : 10;
return s;
}
/**
* @link https://github.com/phalcon/zephir/issues/297
*/
public function testTernaryAfterLetVariable()
{
var s = 23;
let s = 1===1 ? 3 : 10;
return s;
}
}
@@ -27,15 +27,16 @@ public function testTernary()
$this->assertEquals(101, $t->testTernary1());
$this->assertEquals('foo', $t->testTernary2(true));
$this->assertEquals('bar', $t->testTernary2(false));
$this->assertEquals(3, $t->testTernaryAfterLetVariable());
$this->assertEquals(array('', 'c', ''), $t->testTernaryWithPromotedTemporaryVariable());
}
/*public function testComplex()
public function testComplex()
{
$t = new \Test\Ternary();
$this->assertTrue($t->testTernaryComplex1(array(), "") === 101);
$this->assertTrue($t->testTernaryComplex2(array(), "") === 106);
$this->assertTrue($t->testTernaryComplex3("") === "boolean");
}*/
$this->assertSame(101, $t->testTernaryComplex1(array(), ""));
$this->assertSame(106, $t->testTernaryComplex2(array(), ""));
$this->assertSame("boolean", $t->testTernaryComplex3(""));
}
}

0 comments on commit ff7bff1

Please sign in to comment.