Merge pull request #42 from ericbmerritt/next
minor bugfixes and cleanup
This commit is contained in:
commit
0fbd4576ce
3 changed files with 12 additions and 25 deletions
6
Makefile
6
Makefile
|
@ -15,9 +15,9 @@ endif
|
|||
|
||||
ERLWARE_COMMONS_PLT=$(CURDIR)/.erlware_commons_plt
|
||||
|
||||
.PHONY: all compile doc clean test shell distclean pdf get-deps rebuild #dialyzer typer #fail on Travis.
|
||||
.PHONY: all compile doc clean test shell distclean pdf get-deps rebuild dialyzer typer
|
||||
|
||||
all: compile doc test #dialyzer #fail on travis
|
||||
all: compile doc test
|
||||
|
||||
deps: .DEV_MODE
|
||||
$(REBAR) get-deps compile
|
||||
|
@ -91,4 +91,4 @@ distclean: clean
|
|||
rm -rvf $(CURDIR)/deps
|
||||
rm -rvf .DEV_MODE
|
||||
|
||||
rebuild: distclean get-deps all
|
||||
rebuild: distclean all
|
||||
|
|
|
@ -22,8 +22,7 @@
|
|||
md5sum/1,
|
||||
read/1,
|
||||
write/2,
|
||||
write_term/2,
|
||||
consult/1
|
||||
write_term/2
|
||||
]).
|
||||
|
||||
-export_type([
|
||||
|
@ -174,16 +173,6 @@ mkdir_path(Path) ->
|
|||
mkdir_p(Path).
|
||||
|
||||
|
||||
%% @doc consult an erlang term file from the file system.
|
||||
%% Provide user readible exeption on failure.
|
||||
-spec consult(FilePath::file:name()) -> term().
|
||||
consult(FilePath) ->
|
||||
case file:consult(FilePath) of
|
||||
{ok, [Term]} ->
|
||||
Term;
|
||||
Error ->
|
||||
Error
|
||||
end.
|
||||
%% @doc read a file from the file system. Provide UEX exeption on failure.
|
||||
-spec read(FilePath::file:filename()) -> binary() | {error, Reason::term()}.
|
||||
read(FilePath) ->
|
||||
|
@ -327,12 +316,10 @@ file_test() ->
|
|||
filelib:ensure_dir(TermFile),
|
||||
filelib:ensure_dir(TermFileCopy),
|
||||
write_term(TermFile, "term"),
|
||||
?assertMatch("term", consult(TermFile)),
|
||||
?assertMatch({ok, <<"\"term\". ">>}, read(TermFile)),
|
||||
copy(filename:dirname(TermFile),
|
||||
filename:dirname(TermFileCopy),
|
||||
[recursive]),
|
||||
?assertMatch("term", consult(TermFileCopy)).
|
||||
[recursive]).
|
||||
|
||||
teardown_test() ->
|
||||
Dir = insecure_mkdtemp(),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue