Build custom database in test
This commit is contained in:
parent
1d949c82ca
commit
6672860b19
2 changed files with 5 additions and 12 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,8 +42,9 @@ defmodule GenMagicTest do
|
|||
end
|
||||
|
||||
test "Custom database file recognises Elixir files" do
|
||||
database = absolute_path("test/elixir.mgc")
|
||||
IO.puts("Database: #{inspect(database)} #{inspect(File.exists?(database))}")
|
||||
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