add unit tests for tags.scm queries (#27)
parent
1344bb095f
commit
6702d11ec4
@ -0,0 +1,31 @@
|
||||
defmodule Foo.Bar.Baz do
|
||||
# ^ definition.module
|
||||
# ^ definition.module
|
||||
# ^ definition.module
|
||||
|
||||
def init(arg) do
|
||||
# ^ definition.function
|
||||
state =
|
||||
arg
|
||||
|> map(&(&1 * 2))
|
||||
# ^ reference.call
|
||||
|> map(&(&1 + 1))
|
||||
# ^ reference.call
|
||||
|
||||
{:ok, arg}
|
||||
end
|
||||
|
||||
def map(list, fun, acc \\ [])
|
||||
# ^ definition.function
|
||||
|
||||
def map([head | rest], fun, acc) do
|
||||
# ^ definition.function
|
||||
map(rest, fun, [fun.(head) | acc])
|
||||
# <- reference.call
|
||||
end
|
||||
|
||||
def map([], _fun, acc), do: Enum.reverse(acc)
|
||||
# ^ definition.function
|
||||
# ^ reference.module
|
||||
# ^ reference.call
|
||||
end
|
@ -0,0 +1,21 @@
|
||||
defprotocol Countable do
|
||||
# ^ definition.module
|
||||
def count(data)
|
||||
# ^ definition.function
|
||||
end
|
||||
|
||||
defimpl Countable, for: Binary do
|
||||
# ^ reference.module
|
||||
# ^ reference.module
|
||||
def count(binary), do: byte_size(binary)
|
||||
# ^ definition.function
|
||||
# ^ reference.call
|
||||
end
|
||||
|
||||
defimpl Countable, for: List do
|
||||
# ^ reference.module
|
||||
# ^ reference.module
|
||||
def count(list), do: length(list)
|
||||
# ^ definition.function
|
||||
# ^ reference.call
|
||||
end
|
Loading…
Reference in new issue