From 9019a6f8273a460564cc5d1c11f273d8385db4cc Mon Sep 17 00:00:00 2001 From: Strahinja Markovic Date: Mon, 16 Apr 2012 21:57:20 -0700 Subject: [PATCH] Test for query as prefix of candidate preference --- cpp/tests/Completer_test.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/cpp/tests/Completer_test.cpp b/cpp/tests/Completer_test.cpp index 332308db..d3a7019b 100644 --- a/cpp/tests/Completer_test.cpp +++ b/cpp/tests/Completer_test.cpp @@ -164,6 +164,18 @@ TEST_F( CompleterTest, RatioUtilizationTieBreak ) "FooBarQuxZaa" ) ); } +TEST_F( CompleterTest, QueryPrefixOfCandidateWins ) +{ + Pylist results; + Completer( Candidates( + "foobar", + "fbaroo" ) ).GetCandidatesForQuery( "foo", results ); + + EXPECT_THAT( ToStringVector( results ), + ElementsAre( "foobar", + "fbaroo" ) ); +} + TEST_F( CompleterTest, ShorterCandidateWins ) { Pylist results;