Pudu programming language
Menu
Package

@chrismichaelps / pudu-lang-resilience

Resilience pipelines for Pudu: retry, circuit breaker, timeout, fallback, hedging, rate limiting, and chaos injection

0.1.0Apache-2.01

InstallClose

TemplateTest.pudu

Pudu25 lines1.1 KB

GitHub ↗
1/** @Test.Utils.Template.Suite — numbered slots in message text */2module PuduLangResilience.Utils.TemplateTest34import Std.Io as Io5import Std.Test as Test6import PuduLangResilience.Utils.Template as Template78/// Runs the suite.9fn main() -> Int {10  let checks = Test.suite("Utils.Template", &[11      Test.equals("each slot takes its value", &Template.fill("<1> then <2>", &["a", "b"]), &"a then b"),12      Test.equals("a slot used twice is filled twice", &Template.fill("<1>/<1>", &["x"]), &"x/x"),13      Test.equals("a slot without a value is kept", &Template.fill("<1> <2>", &["only"]), &"only <2>"),14      Test.equals("text without slots is unchanged", &Template.fill("plain", &["unused"]), &"plain"),15      Test.equals("a value holding slot text is not filled again", &Template.fill("<1> <2>", &["<2>", "b"]), &"<2> b"),16      Test.equals("angle brackets that are not slots are kept", &Template.fill("a < b > c <x> <", &["v"]), &"a < b > c <x> <"),17      Test.equals("slot zero has no value", &Template.fill("<0>", &["v"]), &"<0>")18    ])19  let ran = Test.run(&checks)20  for failure in Test.failuresOf(&ran) {21    let _reported = Io.writeErrorLine(failure)22  }23  Test.report(&ran)24}25