b0o / Mulberry

Mulberry is a single-file Lua BDD library for testing Neovim plugins.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Mulberry license: MIT Test Status

Mulberry is a single-file Lua BDD library for testing Neovim plugins. Its goal is to make testing your plugins as easy and delicious as possible.

An example Mulberry test suite:

Describe("the awesome foobar plugin", function()
  It("can do the foo.do", function()
    local foo = require'foo'
    local myFoo = { lol: 'wut', yes: 'no' }
    local bar = foo.do(myFoo)
    Expect(bar).To.Be.A.ListLike()
  end)

  It("can foo.bar all the things", function()
    local foo = require'foo'
    local bar = foo.bar({ allTheThings: true })

    Expect(bar).To.HaveFieldPaths({
      { 'theThings.allOfThem[1].description', Which.Is.A.String   },
      { 'theThings.allOfThem[1].items',       Which.Is.A.ListLike },
      { 'theThings.allOfThem[1].name',        Which.Is.A.String   },
      { 'theThings.allOfThem[1].url',         Which.Is.A.String   },
      { 'theThings.allOfThem[1].enabled',     Which.Is.True       },
    })
  end)

  It("doesn't go meta on you", function()
    local foo = require'foo'
    Expect(foo).To.Not.HaveMetatable()
  end)

  It("always calls you back", function()
    local foo = require'foo'
    Expect(foo.someFooFunction).To.EvaluateTo(0xF00)
  end)
end)

Changelog

v0.0.3                                                                2023-07-31
  fix: ensure ListLike and DictLike values are tables
  fix: implement list_contains for nvim < v0.10
v0.0.2                                                                2023-07-31
  fix: matchers.In should check for existence of keys, not values

License

© 2021-2023 Maddison Hellstrom

Released under the MIT License.

About

Mulberry is a single-file Lua BDD library for testing Neovim plugins.

License:MIT License


Languages

Language:Lua 96.8%Language:Shell 3.1%Language:Makefile 0.1%