Lua单元测试框架 busted

码农软件 · 软件分类 · 单元测试工具 · 2019-11-19 06:11:46

软件介绍

busted 是 Lua 的单元测试框架,示例代码:

require("busted")

describe("Busted unit testing framework", function()
  describe("should be awesome", function()
    it("should be easy to use", function()
      assert.truthy("Yup.")
    end)

    it("should have lots of features", function()
      -- deep check comparisons!
      assert.are.same({ table = "great"}, { table = "great" })

      -- or check by reference!
      assert.are_not.equal({ table = "great"}, { table = "great"})

      assert.true(1 == 1)
      assert.falsy(nil)
      assert.has.error(function() error("Wat") end, "Wat")
    end)

    it("should provide some shortcuts to common functions", function()
      assert.are.unique({{ thing = 1 }, { thing = 2 }, { thing = 3 }})
    end)

    it("should have mocks and spies for functional tests", function()
      local thing = require("thing_module")
      spy.spy_on(thing, "greet")
      thing.greet("Hi!")

      assert.spy(thing.greet).was.called()
      assert.spy(thing.greet).was.called_with("Hi!")
    end)
  end)
end)

执行结果:

本文地址:https://codercto.com/soft/d/19301.html

KK三部曲

KK三部曲

(美)凯文·凯利(Kevin Kelly) / 张行舟 / 中信出版社 / 2015-12-12 / 80.00元

《失控 全人类的*终命运和结局》这是《黑客帝国》主要演员的必读物之一,这本关于机器、系统、生物和社会的“大部头”,揭示了社会进化、特别是互联网发展的“先知预言”,从这本书里,人们可以窥探到SNS的今天和未来。 《失控 全人类的*终命运和结局》涉猎:天文、化学、生物、计算机、控制论、运筹学、社会学…… 同时又堪比《黑客帝国》中洞悉未来的“神谕”,正在兴起的“云计算”、“物联网”等都可以在......一起来看看 《KK三部曲》 这本书的介绍吧!

HTML 压缩/解压工具
HTML 压缩/解压工具

在线压缩/解压 HTML 代码

CSS 压缩/解压工具
CSS 压缩/解压工具

在线压缩/解压 CSS 代码

UNIX 时间戳转换
UNIX 时间戳转换

UNIX 时间戳转换