@@ -474,8 +474,8 @@ using SetUpTestSuiteFunc = void (*)();
474
474
using TearDownTestSuiteFunc = void (*)();
475
475
476
476
struct CodeLocation {
477
- CodeLocation (std::string a_file, int a_line)
478
- : file(std::move( a_file) ), line(a_line) {}
477
+ CodeLocation (const std::string& a_file, int a_line)
478
+ : file(a_file), line(a_line) {}
479
479
480
480
std::string file;
481
481
int line;
@@ -564,7 +564,7 @@ struct SuiteApiResolver : T {
564
564
// The newly created TestInfo instance will assume
565
565
// ownership of the factory object.
566
566
GTEST_API_ TestInfo* MakeAndRegisterTestInfo (
567
- std::string test_suite_name, const char * name, const char * type_param,
567
+ const char * test_suite_name, const char * name, const char * type_param,
568
568
const char * value_param, CodeLocation code_location,
569
569
TypeId fixture_class_id, SetUpTestSuiteFunc set_up_tc,
570
570
TearDownTestSuiteFunc tear_down_tc, TestFactoryBase* factory);
@@ -595,7 +595,8 @@ class GTEST_API_ TypedTestSuitePState {
595
595
fflush (stderr);
596
596
posix::Abort ();
597
597
}
598
- registered_tests_.emplace (test_name, CodeLocation (file, line));
598
+ registered_tests_.insert (
599
+ ::std::make_pair (test_name, CodeLocation(file, line)));
599
600
return true ;
600
601
}
601
602
@@ -699,7 +700,7 @@ class TypeParameterizedTest {
699
700
// specified in INSTANTIATE_TYPED_TEST_SUITE_P(Prefix, TestSuite,
700
701
// Types). Valid values for 'index' are [0, N - 1] where N is the
701
702
// length of Types.
702
- static bool Register (const char * prefix, CodeLocation code_location,
703
+ static bool Register (const char * prefix, const CodeLocation& code_location,
703
704
const char * case_name, const char * test_names, int index,
704
705
const std::vector<std::string>& type_names =
705
706
GenerateNames<DefaultNameGenerator, Types>()) {
@@ -711,7 +712,8 @@ class TypeParameterizedTest {
711
712
// list.
712
713
MakeAndRegisterTestInfo (
713
714
(std::string (prefix) + (prefix[0 ] == ' \0 ' ? " " : " /" ) + case_name +
714
- " /" + type_names[static_cast <size_t >(index )]),
715
+ " /" + type_names[static_cast <size_t >(index )])
716
+ .c_str (),
715
717
StripTrailingSpaces (GetPrefixUntilComma (test_names)).c_str (),
716
718
GetTypeName<Type>().c_str (),
717
719
nullptr , // No value parameter.
@@ -723,17 +725,21 @@ class TypeParameterizedTest {
723
725
new TestFactoryImpl<TestClass>);
724
726
725
727
// Next, recurses (at compile time) with the tail of the type list.
726
- return TypeParameterizedTest<Fixture, TestSel, typename Types::Tail>::
727
- Register (prefix, std::move (code_location), case_name, test_names,
728
- index + 1 , type_names);
728
+ return TypeParameterizedTest<Fixture, TestSel,
729
+ typename Types::Tail>::Register (prefix,
730
+ code_location,
731
+ case_name,
732
+ test_names,
733
+ index + 1 ,
734
+ type_names);
729
735
}
730
736
};
731
737
732
738
// The base case for the compile time recursion.
733
739
template <GTEST_TEMPLATE_ Fixture, class TestSel >
734
740
class TypeParameterizedTest <Fixture, TestSel, internal::None> {
735
741
public:
736
- static bool Register (const char * /* prefix*/ , CodeLocation,
742
+ static bool Register (const char * /* prefix*/ , const CodeLocation& ,
737
743
const char * /* case_name*/ , const char * /* test_names*/ ,
738
744
int /* index*/ ,
739
745
const std::vector<std::string>& =
@@ -780,8 +786,7 @@ class TypeParameterizedTestSuite {
780
786
781
787
// Next, recurses (at compile time) with the tail of the test list.
782
788
return TypeParameterizedTestSuite<Fixture, typename Tests::Tail,
783
- Types>::Register (prefix,
784
- std::move (code_location),
789
+ Types>::Register (prefix, code_location,
785
790
state, case_name,
786
791
SkipComma (test_names),
787
792
type_names);
0 commit comments