Skip to content

Instantly share code, notes, and snippets.

@masayuki038
Created June 8, 2013 10:47
Show Gist options
  • Save masayuki038/5734807 to your computer and use it in GitHub Desktop.
Save masayuki038/5734807 to your computer and use it in GitHub Desktop.
-module(thrift_hive_tests).
-include_lib("eunit/include/eunit.hrl").
timeout_test() ->
timer:sleep(3000),
{timeout, 15, ?_assertEqual(true, begin timer:sleep(10000), false end)}.
@masayuki038
Copy link
Author

$ rebar eunit -v suites=thrift_hive_tests skip_deps=true tests=timeout_test
WARN:  Ignoring sub_dirs for /home/masayuki/work/erlang/thrift-hive/deps/thrift_erl
==> rel (eunit)
==> thrift-hive (eunit)
NOTICE: Using experimental option 'tests'
    Running test function(s):
      thrift_hive_tests:timeout_test/0
======================== EUnit ========================
thrift_hive_tests: timeout_test...[3.014 s] ok
=======================================================
  Test passed.

@masayuki038
Copy link
Author

$ erl
Erlang R16B (erts-5.10.1) [source] [async-threads:10] [kernel-poll:false]

Eshell V5.10.1  (abort with ^G)
1> c(thrift_hive_tests).
{ok,thrift_hive_tests}
2> eunit:test(thrift_hive_tests:timeout_test()).
thrift_hive_tests:6: timeout_test...*failed*
in function thrift_hive_tests:'-timeout_test/0-fun-0-'/1 (thrift_hive_tests.erl, line 6)
**error:{assertEqual_failed,[{module,thrift_hive_tests},
                     {line,6},
                     {expression,"begin timer : sleep ( 10000 ) , false end"},
                     {expected,true},
                     {value,false}]}


=======================================================
  Failed: 1.  Skipped: 0.  Passed: 0.
error

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment