Made grep version command's grep POSIX

This commit is contained in:
Joe DeVivo 2015-07-12 07:31:08 -07:00
parent e56c73c940
commit 381189c006
2 changed files with 19 additions and 1 deletions

15
test/ec_git_vsn_tests.erl Normal file
View file

@ -0,0 +1,15 @@
-module(ec_git_vsn_tests).
-include_lib("eunit/include/eunit.hrl").
-compile([export_all]).
%% Hi! This test only works because you've cloned this repo out of git
%% AND we're tagging this repo with a "v" prefix. Hey, it's better
%% than nothing.
vsn_grep_test() ->
{ok, VSN} = ec_git_vsn:vsn({"v"}),
[$v|OtherVSN] = os:cmd("git tag | xargs -I@ git log --format=format:\"%ai @%n\" -1 @ | sort -r | awk '{print $4}' | head -n 1"),
?assertEqual(OtherVSN, VSN ++ "\n"),
ok.