defmodule Issues.Mixfile do
use Mix.Project
def project do
[ app: :issues,
version: "0.0.1",
deps: deps
]
end
# Configuration for the OTP application
def application do
[]
end
# Returns the list of dependencies in the format:
# { :foobar, "0.1", git: "https://github.com/elixir-lang/foobar.git" }
defp deps do
[]
end
end

列印 project deps 相關 libs

$ mix deps

取得 deps

$ mix deps.get

執行測試

$ mix test
warning: variable "deps" does not exist and is being expanded to "deps()", please use parentheses to remove the ambiguity or change the variable name
mix.exs:7
Compiling 2 files (.ex)
Generated issues app
warning: this check/guard will always yield the same result
test/issues_test.exs:5
....
Finished in 0.05 seconds
4 tests, 0 failures
Randomized with seed 80914

could not compile dependency :jsonex, "mix compile" failed. You can recompile this dependency with "mix deps.compile jsonex", update it with "mix deps.update jsonex" or clean it with "mix deps.clean jsonex"
==> issues
** (Mix) Expected :version to be a SemVer version, got: "2.0"

defmodule ElixirCalc.Calculator do
def fib(0) do 0 end
def fib(1) do 1 end
def fib(n) do
fib(n - 1) + fib(n - 2)
end
end

test/elixircalctest.exs

defmodule ElixirCalcTest do
use ExUnit.Case
doctest ElixirCalc
test "fibonacci of 1 is 1" do
assert ElixirCalc.Calculator.fib(1) == 1
end
test "fibonacci of 2 is 1" do
assert ElixirCalc.Calculator.fib(2) == 1
end
test "fibonacci of 10 is 55" do
assert ElixirCalc.Calculator.fib(10) == 55
end
end