在 Gleam 軌道上測試

了解如何在 Exercism 上測試你的 Gleam 練習。


在終端機中,先切換到練習的基底目錄,然後用以下指令執行測試:

$ gleam test

這會執行test子資料夾裡的測試檔案,也就是以_test.gleam結尾的檔案。

測試函式

這些測試使用自訂測試框架。在test目錄中,任何名稱以_test結尾的公開函式,都會被測試框架視為一項測試。

例如:

import bob
import exercism/should

pub fn shouting_test {
  bob.hey("WATCH OUT!")
  |> should.equal("Whoa, chill out!")
}