Skip to content

Commit

Permalink
[tests] test change can remains
Browse files Browse the repository at this point in the history
  • Loading branch information
yuxiaomao committed Sep 11, 2024
1 parent bf450c7 commit 5f43ad6
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 1 deletion.
2 changes: 1 addition & 1 deletion tests/unit/src/unit/UnitBuilder.hx
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ class UnitBuilder {
case EBinop(OpEq, e1, e2):
mkEq(e1, e2, e.pos);
case EBinop(OpNotEq, e1, e2):
macro t($e1 != $e2);
macro @:pos(e.pos) t($e1 != $e2);
case EBinop(OpGt | OpGte | OpLt | OpLte, _, _):
{
expr: (macro t($e)).expr,
Expand Down
30 changes: 30 additions & 0 deletions tests/unit/src/unit/issues/Issue11734.hx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,22 @@ import unit.Test;
import hl.NativeArray;
#end

private class Group<T> {
public var grid : haxe.ds.Vector<Array<T>>;
public function new(size:Int) {
grid = new haxe.ds.Vector(size);
for (i in 0...size)
grid[i] = [];
}
}

private class Foo {
public var x : Int;
public function new(x:Int) {
this.x = x;
}
}

class Issue11734 extends Test {
#if hl
function test() {
Expand All @@ -16,4 +32,18 @@ class Issue11734 extends Test {
feq(1.0, a[0]);
}
#end

function testArrayInVector() {
var g = new Group<Foo>(5);
for (i in 0...5)
g.grid[i].push(new Foo(10+i));
eq(10, g.grid[0][0].x);
eq(14, g.grid[4][0].x);

var g = new Group<Float>(5);
for (i in 0...5)
g.grid[i].push(10.0+i);
feq(10.0, g.grid[0][0]);
feq(14.0, g.grid[4][0]);
}
}

0 comments on commit 5f43ad6

Please sign in to comment.