diff options
author | Simon MacMullen <simon@rabbitmq.com> | 2012-12-05 14:08:22 +0000 |
---|---|---|
committer | Simon MacMullen <simon@rabbitmq.com> | 2012-12-05 14:08:22 +0000 |
commit | a97c9e6921ef7eced6f1f2d1afb47ed3ba8f2823 (patch) | |
tree | 2537053e930039af59c26930787f2403a6bf2dfb | |
parent | 98d871ee77528da4e732dae179d5986b9350720e (diff) | |
download | rabbitmq-server-bug25330.tar.gz |
Tweak the regex, align, and a test.bug25330
-rw-r--r-- | src/rabbit_misc.erl | 4 | ||||
-rw-r--r-- | src/rabbit_tests.erl | 11 |
2 files changed, 13 insertions, 2 deletions
diff --git a/src/rabbit_misc.erl b/src/rabbit_misc.erl index 70ab6c71..4efde50e 100644 --- a/src/rabbit_misc.erl +++ b/src/rabbit_misc.erl @@ -739,10 +739,10 @@ version_compare(A, B) -> %% a.b.c and a.b.d match, but a.b.c and a.d.e don't. If %% versions do not match that pattern, just compare them. version_minor_equivalent(A, B) -> - {ok, RE} = re:compile("^(\\d+\\.\\d+)(\\.\\d+)*\$"), + {ok, RE} = re:compile("^(\\d+\\.\\d+)(\\.\\d+)\$"), Opts = [{capture, all_but_first, list}], case {re:run(A, RE, Opts), re:run(B, RE, Opts)} of - {{match, [A1|_]}, {match, [B1|_]}} -> A1 =:= B1; + {{match, [A1|_]}, {match, [B1|_]}} -> A1 =:= B1; _ -> A =:= B end. diff --git a/src/rabbit_tests.erl b/src/rabbit_tests.erl index 983abf29..a68caadb 100644 --- a/src/rabbit_tests.erl +++ b/src/rabbit_tests.erl @@ -38,6 +38,7 @@ all_tests() -> passed = mirrored_supervisor_tests:all_tests(), application:set_env(rabbit, file_handles_high_watermark, 10, infinity), ok = file_handle_cache:set_limit(10), + passed = test_version_equivalance(), passed = test_multi_call(), passed = test_file_handle_cache(), passed = test_backing_queue(), @@ -141,6 +142,16 @@ run_cluster_dependent_tests(SecondaryNode) -> passed. +test_version_equivalance() -> + true = rabbit_misc:version_minor_equivalent("3.0.0", "3.0.0"), + true = rabbit_misc:version_minor_equivalent("3.0.0", "3.0.1"), + true = rabbit_misc:version_minor_equivalent("%%VSN%%", "%%VSN%%"), + false = rabbit_misc:version_minor_equivalent("3.0.0", "3.1.0"), + false = rabbit_misc:version_minor_equivalent("3.0.0", "3.0"), + false = rabbit_misc:version_minor_equivalent("3.0.0", "3.0.0.1"), + false = rabbit_misc:version_minor_equivalent("3.0.0", "3.0.foo"), + passed. + test_multi_call() -> Fun = fun() -> receive |