You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This plugin adds a command to easily add more modules to your Mix project.
Just like Mix, it creates a lib and a test file for you to start coding.
Self-generate modules and unit tests
Hit :EX and vim will prompt you to include the path of your new module:
Type the path (e.g store/cart/item):
if you type shopping/cart, it will generate two files:
lib/shopping/cart.ex
defmoduleStore.Cartdo@moduledoc""" Some Module main doc.. """@doc""" Some method behavior. ## Examples iex> Store.Cart.some_method([]) {:ok} """defsome_method(opts\\[])defsome_method(opts)whenopts==[]do{:ok}enddefsome_method(opts)do{:ok,[opts]}enddefpprivate_methoddo{:ok}endend
test/shopping/cart_test.exs
defmoduleShopping.CartTestdouseStore.DataCasealiasShopping.Cartsetupdo:okenddescribe"some_method/0"dotest"some method without param"do" assert Cart.some_method == {:ok} end end describe "some_method/1" do test "somemethodwithparam" do"assertCart.some_method(1)=={:ok,[1]}endendend
You may wanna use vim.test
to run your test with a key mapping. If offers a large amount supported languages.