Skip to content

Commit

Permalink
Add missing space, add unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
yuxiaomao committed Feb 23, 2024
1 parent a956427 commit 4039baa
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/generators/hlopt.ml
Expand Up @@ -482,7 +482,7 @@ let code_graph (f:fundecl) =
} in
Hashtbl.add blocks_pos pos b;
let rec loop i =
let goto ?(tl=b.btrap) d=
let goto ?(tl=b.btrap) d =
let b2 = make_block tl (i + 1 + d) in
b2.bprev <- b :: b2.bprev;
b2
Expand Down
14 changes: 14 additions & 0 deletions tests/unit/src/unit/issues/Issue11466.hx
@@ -0,0 +1,14 @@
package unit.issues;

class Issue11466 extends unit.Test {
var b = 10;
function test() {
var x = 0;
try {
x = b;
throw "hi";
}catch(_) {

This comment has been minimized.

Copy link
@Simn

Simn Feb 23, 2024

Member

That's a bit funny in a "Add missing space" commit.

This comment has been minimized.

Copy link
@yuxiaomao

yuxiaomao Feb 23, 2024

Author Contributor

I saw the missing space, and I feel it is a little bit "alone" if I don't add something else. - Can remove these tests if necessary

This comment has been minimized.

Copy link
@Simn

Simn Feb 23, 2024

Member

What I was trying to say is that there's also a missing space between the } and the catch.

This comment has been minimized.

Copy link
@yuxiaomao

yuxiaomao Feb 23, 2024

Author Contributor

Oh!!! I copied it from the issues :( Let me check the integer approach before commit it alone

eq(b, x);
}
}
}
18 changes: 18 additions & 0 deletions tests/unit/src/unit/issues/Issue9174.hx
@@ -0,0 +1,18 @@
package unit.issues;

class Issue9174 extends unit.Test {
function test() {
var value = false;
try {
try {
throw '';
} catch(e:String) {
value = true;
t(value);
throw e;
}
} catch(e:String) {
t(value);

This comment has been minimized.

Copy link
@Simn

Simn Feb 23, 2024

Member

Note that this doesn't necessarily test if we actually get here. Maybe turn value into an integer and increment it, then check the value at function end.

This comment has been minimized.

Copy link
@Simn

Simn Feb 23, 2024

Member

Or maybe even concat a String together so that we can distinguish the two catch cases. Otherwise we could in theory land in the same catch twice.

}
}
}

0 comments on commit 4039baa

Please sign in to comment.