Build custom database in test
This commit is contained in:
parent
87415c4854
commit
22024701a5
2 changed files with 5 additions and 11 deletions
12
Makefile
12
Makefile
|
@ -6,24 +6,16 @@ CFLAGS = -std=c99 -g -Wall -Werror
|
|||
CPPFLAGS = -I$(ERL_EI_INCLUDE)
|
||||
LDFLAGS = -L$(ERL_EI_LIB)
|
||||
LDLIBS = -lpthread -lei -lm -lmagic
|
||||
BEAM_FILES = _build/
|
||||
PRIV = priv/
|
||||
RM = rm -Rf
|
||||
|
||||
# Unit test custom magic file
|
||||
|
||||
MAGIC = file
|
||||
|
||||
all: priv/apprentice test/elixir.mgc
|
||||
|
||||
test/%.mgc: test/%
|
||||
cd test; file -C -m ../$^
|
||||
all: priv/apprentice
|
||||
|
||||
priv/apprentice: src/apprentice.c
|
||||
mkdir -p priv
|
||||
$(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) $^ $(LDLIBS) -o $@
|
||||
|
||||
clean:
|
||||
$(RM) $(PRIV) $(BEAM_FILES) test/*.mgc
|
||||
$(RM) $(PRIV)
|
||||
|
||||
.PHONY: clean
|
||||
|
|
|
@ -42,7 +42,9 @@ defmodule GenMagicTest do
|
|||
end
|
||||
|
||||
test "Custom database file recognises Elixir files" do
|
||||
database = absolute_path("test/elixir.mgc")
|
||||
database = absolute_path("elixir.mgc")
|
||||
on_exit(fn() -> File.rm(database) end)
|
||||
{_, 0} = System.cmd("file", ["-C", "-m", absolute_path("test/elixir")])
|
||||
{:ok, pid} = GenMagic.Server.start_link(database_patterns: [database])
|
||||
path = absolute_path("mix.exs")
|
||||
assert {:ok, %Result{} = result} = GenMagic.Server.perform(pid, path)
|
||||
|
|
Loading…
Reference in a new issue