Skip to content
Snippets Groups Projects
Commit 22024701 authored by href's avatar href
Browse files

Build custom database in test

parent 87415c48
No related branches found
No related tags found
No related merge requests found
......@@ -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)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment