Skip to content

Commit

Permalink
Avoid use of "fun" as an identifier
Browse files Browse the repository at this point in the history
  • Loading branch information
titzer committed Aug 5, 2024
1 parent 2a9fe91 commit 20d552e
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 13 deletions.
8 changes: 4 additions & 4 deletions apps/TypeRep/UnitTests.v3
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ component UnitTests {
var list: List<UnitTest>;
var fatal: bool = false;
private def buf = StringBuilder.new();
def register(name: string, fun: Tester -> ()) {
list = List.new(UnitTest.new(name, fun), list);
def register(name: string, func: Tester -> ()) {
list = List.new(UnitTest.new(name, func), list);
}
def registerT<T>(prefix: string, name: string, n: Tester -> T, f: T -> void) {
if (prefix != null) name = buf.reset().puts(prefix).puts(name).toString();
Expand Down Expand Up @@ -42,7 +42,7 @@ component UnitTests {
System.puts("##+");
System.puts(u.name);
System.ln();
u.fun(t);
u.func(t);
if (t.ok) {
passed++;
System.puts("##-ok\n");
Expand All @@ -56,7 +56,7 @@ component UnitTests {
}
}
// An individual unit test.
class UnitTest(name: string, fun: Tester -> ()) { }
class UnitTest(name: string, func: Tester -> ()) { }
// Tester that is capable of generating and recording errors.
class Tester(name: string) {
var ok = true;
Expand Down
2 changes: 1 addition & 1 deletion lib/ic/ic0_untyped.v3
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ import component ic0 {
reply_env: i32,
reject_fun: i32,
reject_env: i32);
def call_on_cleanup(fun: i32, env: i32); // U Ry Rt T
def call_on_cleanup(func: i32, env: i32); // U Ry Rt T
def call_data_append(src: i32, size: i32); // U Ry Rt T
def call_cycles_add(amount: i64); // U Ry Rt T
def call_cycles_add128(amount_high: i64, amount_low: i64); // U Ry Rt T
Expand Down
8 changes: 4 additions & 4 deletions lib/test/UnitTests.v3
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ component UnitTests {
var trace: bool = false;

// Registration methods.
def register(name: string, fun: Tester -> ()) {
list = List.new(UnitTest(name, fun), list);
def register(name: string, func: Tester -> ()) {
list = List.new(UnitTest(name, func), list);
}
def registerT<T>(prefix: string, name: string, n: Tester -> T, f: T -> void) {
if (prefix != null) name = buf.reset().puts(prefix).puts(name).extract();
Expand Down Expand Up @@ -73,7 +73,7 @@ component UnitTests {
System.puts(u.name);
System.ln();
var before = if(trace, System.ticksUs());
u.fun(t);
u.func(t);
if (trace) {
var diff = System.ticksUs() - before;
System.puts("##@");
Expand Down Expand Up @@ -121,7 +121,7 @@ component UnitTests {
}

// An individual unit test.
private type UnitTest(name: string, fun: Tester -> ()) #unboxed;
private type UnitTest(name: string, func: Tester -> ()) #unboxed;

// Custom renderers to make using assertions extensible.
private class Renderer(next: Renderer) {
Expand Down
8 changes: 4 additions & 4 deletions test/lib/main.v3
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@
// itself, since that is the code under test.
component LibTests {
var list: LibTest;
def register(prefix: string, name: string, fun: LibTest -> void) {
list = LibTest.new(prefix, name, fun, list);
def register(prefix: string, name: string, func: LibTest -> void) {
list = LibTest.new(prefix, name, func, list);
}
}

// For simplicity, each test is instantiated only once and has only pass/fail state.
class LibTest(prefix: string, name: string, fun: LibTest -> void, tail: LibTest) {
class LibTest(prefix: string, name: string, func: LibTest -> void, tail: LibTest) {
var ok: bool = true;

def fail(msg: string) {
Expand Down Expand Up @@ -116,7 +116,7 @@ def main(args: Array<string>) -> int {
System.puts(t.name);
System.ln();

t.fun(t);
t.func(t);

if (t.ok) System.puts("##-ok\n");
else fail = true;
Expand Down

0 comments on commit 20d552e

Please sign in to comment.