Skip to content

Commit c790adc

Browse files
authored
chore: Supress warnings when testing fromNumber (#2058)
1 parent e4b97ea commit c790adc

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

compiler/test/stdlib/rational.test.gr

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ use Rational.{
1515
}
1616

1717
// Rational.fromNumber
18+
// Operations Tests
19+
// Suppress warnings about using `fromNumber` on constants, since that's what we want to test.
20+
let fromNumber = fromNumber
1821
assert fromNumber(1/2) == 1/2r
1922
assert fromNumber(0) == 0/1r
2023
assert fromNumber(1/1) == 1/1r

compiler/test/suites/numbers.re

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -179,12 +179,22 @@ describe("numbers", ({test, testSkip}) => {
179179
);
180180
assertRunError(
181181
"shortnum_err1",
182-
{|from "uint8" include Uint8; print(Uint8.fromNumber(-1))|},
182+
{|
183+
from "uint8" include Uint8;
184+
// Suppress warnings about using `fromNumber` on constants, since that's what we want to test.
185+
let fromNumber = Uint8.fromNumber
186+
print(fromNumber(-1))
187+
|},
183188
"Overflow: Number overflow",
184189
);
185190
assertRunError(
186191
"shortnum_err2",
187-
{|from "uint8" include Uint8; print(Uint8.fromNumber(256))|},
192+
{|
193+
from "uint8" include Uint8;
194+
// Suppress warnings about using `fromNumber` on constants, since that's what we want to test.
195+
let fromNumber = Uint8.fromNumber
196+
print(fromNumber(256))
197+
|},
188198
"Overflow: Number overflow",
189199
);
190200
assertCompileError(

0 commit comments

Comments
 (0)