Fix missing reset of index
[TortoiseGit.git] / test / UnitTests / ProjectPropertiesTest.cpp
blob50695798cfb009d49af5613f007d38a643c00849
1 // TortoiseGit - a Windows shell extension for easy version control
3 // Copyright (C) 2015-2016 - TortoiseGit
4 // Copyright (C) 2003-2011 - TortoiseSVN
6 // This program is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU General Public License
8 // as published by the Free Software Foundation; either version 2
9 // of the License, or (at your option) any later version.
11 // This program is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
16 // You should have received a copy of the GNU General Public License
17 // along with this program; if not, write to the Free Software Foundation,
18 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
21 #include "stdafx.h"
22 #include "ProjectProperties.h"
24 TEST(ProjectPropertiesTest, ParseBugIDs)
26 ProjectProperties props;
27 props.sCheckRe = L"PAF-[0-9]+";
28 props.sUrl = L"http://tortoisesvn.tigris.org/issues/show_bug.cgi?id=%BUGID%";
29 CString sRet = props.FindBugID(L"This is a test for PAF-88");
30 ASSERT_TRUE(sRet.IsEmpty());
31 props.sCheckRe = L"[Ii]ssue #?(\\d+)";
32 props.regExNeedUpdate = true;
33 sRet = props.FindBugID(L"Testing issue #99");
34 sRet.Trim();
35 ASSERT_STREQ(L"99", sRet);
36 props.sCheckRe = L"[Ii]ssues?:?(\\s*(,|and)?\\s*#\\d+)+";
37 props.sBugIDRe = L"(\\d+)";
38 props.sUrl = L"http://tortoisesvn.tigris.org/issues/show_bug.cgi?id=%BUGID%";
39 props.regExNeedUpdate = true;
40 sRet = props.FindBugID(L"This is a test for Issue #7463,#666");
41 ASSERT_TRUE(props.HasBugID(L"This is a test for Issue #7463,#666"));
42 ASSERT_FALSE(props.HasBugID(L"This is a test for Issue 7463,666"));
43 sRet.Trim();
44 ASSERT_STREQ(L"666 7463", sRet);
45 sRet = props.FindBugID(L"This is a test for Issue #850,#1234,#1345");
46 sRet.Trim();
47 ASSERT_STREQ(L"850 1234 1345", sRet);
48 props.sCheckRe = L"^\\[(\\d+)\\].*";
49 props.sUrl = L"http://tortoisesvn.tigris.org/issues/show_bug.cgi?id=%BUGID%";
50 props.regExNeedUpdate = true;
51 sRet = props.FindBugID(L"[000815] some stupid programming error fixed");
52 sRet.Trim();
53 ASSERT_STREQ(L"000815", sRet);
54 props.sCheckRe = L"\\[\\[(\\d+)\\]\\]\\]";
55 props.sUrl = L"http://tortoisesvn.tigris.org/issues/show_bug.cgi?id=%BUGID%";
56 props.regExNeedUpdate = true;
57 sRet = props.FindBugID(L"test test [[000815]]] some stupid programming error fixed");
58 sRet.Trim();
59 ASSERT_STREQ(L"000815", sRet);
60 ASSERT_TRUE(props.HasBugID(L"test test [[000815]]] some stupid programming error fixed"));
61 ASSERT_FALSE(props.HasBugID(L"test test [000815]] some stupid programming error fixed"));