diff --git a/compiler/test/suites/numbers.re b/compiler/test/suites/numbers.re index f7b7b29303..b689044079 100644 --- a/compiler/test/suites/numbers.re +++ b/compiler/test/suites/numbers.re @@ -187,7 +187,61 @@ describe("numbers", ({test, testSkip}) => { ); // well-formedness warnings - test("float32_fromNumber_warn1", ({expect}) => { + test("short_fromNumber_warn1", ({expect}) => { + expect.string(Warnings.message(FromNumberLiteral(Uint8, "Uint8", "2"))). + toMatch( + "2us", + ) + }); + test("short_fromNumber_warn2", ({expect}) => { + expect.string( + Warnings.message(FromNumberLiteral(Uint16, "Uint16", "2")), + ). + toMatch( + "2uS", + ) + }); + test("short_fromNumber_warn3", ({expect}) => { + expect.string( + Warnings.message(FromNumberLiteral(Uint32, "Uint32", "2")), + ). + toMatch( + "2ul", + ) + }); + test("short_fromNumber_warn4", ({expect}) => { + expect.string( + Warnings.message(FromNumberLiteral(Uint64, "Uint64", "2")), + ). + toMatch( + "2uL", + ) + }); + test("short_fromNumber_warn5", ({expect}) => { + expect.string(Warnings.message(FromNumberLiteral(Int8, "Int8", "2"))). + toMatch( + "2s", + ) + }); + test("short_fromNumber_warn6", ({expect}) => { + expect.string(Warnings.message(FromNumberLiteral(Int16, "Int16", "2"))). + toMatch( + "2S", + ) + }); + test("short_fromNumber_warn7", ({expect}) => { + expect.string(Warnings.message(FromNumberLiteral(Int32, "Int32", "2"))). + toMatch( + "2l", + ) + }); + test("short_fromNumber_warn8", ({expect}) => { + expect.string(Warnings.message(FromNumberLiteral(Int64, "Int64", "2"))). + toMatch( + "2L", + ) + }); + test("float32_fromNumber_warn9", ({expect}) => { expect.string( Warnings.message(FromNumberLiteral(Float32, "Float32", "5")), ). @@ -235,4 +289,28 @@ describe("numbers", ({test, testSkip}) => { "5.5d", ) }); + test("rational_fromNumber_warn1", ({expect}) => { + expect.string( + Warnings.message(FromNumberLiteral(Rational, "Rational", "2")), + ). + toMatch( + "2/1r", + ) + }); + test("rational_fromNumber_warn2", ({expect}) => { + expect.string( + Warnings.message(FromNumberLiteral(Rational, "Rational", "2/4")), + ). + toMatch( + "2/4r", + ) + }); + test("bigint_fromNumber_warn1", ({expect}) => { + expect.string( + Warnings.message(FromNumberLiteral(BigInt, "Bigint", "2")), + ). + toMatch( + "2t", + ) + }); });