From 84e8f6ec3cca62d2b93a6f8c2c0b863a6eacc4a9 Mon Sep 17 00:00:00 2001 From: x1unix Date: Thu, 19 Dec 2024 17:36:22 -0500 Subject: [PATCH] feat: add flag threshold test --- .../r/demo/boards2/z_2_a_filetest.gno | 2 +- .../r/demo/boards2/z_2_d_filetest.gno | 25 +++++++++++++++++++ 2 files changed, 26 insertions(+), 1 deletion(-) create mode 100644 examples/gno.land/r/demo/boards2/z_2_d_filetest.gno diff --git a/examples/gno.land/r/demo/boards2/z_2_a_filetest.gno b/examples/gno.land/r/demo/boards2/z_2_a_filetest.gno index 626438d0c0a..d95759e4236 100644 --- a/examples/gno.land/r/demo/boards2/z_2_a_filetest.gno +++ b/examples/gno.land/r/demo/boards2/z_2_a_filetest.gno @@ -16,7 +16,7 @@ func main() { bid := boards2.CreateBoard("test1") pid := boards2.CreateThread(bid, "thread", "thread") boards2.FlagThread(bid, pid, "reason") - rid := boards2.CreateReply(bid, pid, pid, "reply") + _ = boards2.CreateReply(bid, pid, pid, "reply") } // Error: diff --git a/examples/gno.land/r/demo/boards2/z_2_d_filetest.gno b/examples/gno.land/r/demo/boards2/z_2_d_filetest.gno new file mode 100644 index 00000000000..dbd809c84cd --- /dev/null +++ b/examples/gno.land/r/demo/boards2/z_2_d_filetest.gno @@ -0,0 +1,25 @@ +package main + +import ( + "std" + + "gno.land/r/demo/boards2" +) + +const owner = std.Address("g1jg8mtutu9khhfwc4nxmuhcpftf0pajdhfvsqf5") // @test1 + +func init() { + std.TestSetOrigCaller(owner) +} + +func main() { + // Only single user per flag can't be tested atm, as flagThreshold = 1. + bid := boards2.CreateBoard("test1") + pid := boards2.CreateThread(bid, "thread", "thread") + + boards2.FlagThread(bid, pid, "reason1") + boards2.FlagThread(bid, pid, "reason2") +} + +// Error: +// item flag count threshold exceeded: 1