Skip to content

Commit 984cbe6

Browse files
committed
.
1 parent 7c0cc6a commit 984cbe6

File tree

2 files changed

+14
-26
lines changed

2 files changed

+14
-26
lines changed

.circleci/circle-msvc.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,4 +50,4 @@ jobs:
5050
command: cd .circleci && build-win
5151
- run:
5252
name: Test
53-
command: cd bin && locale -a && cli --test --verbose
53+
command: cd bin && cli --test

tests/cli/clitest.cpp

Lines changed: 13 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,10 @@
88

99
using namespace std;
1010

11-
#define TEST_EXPLICIT_IMBUE
12-
13-
#if defined(_MSC_VER)
14-
#if defined(__clang__)
11+
#if defined(_MSC_VER) && defined(__clang__)
1512
#pragma clang diagnostic ignored "-Wstring-plus-int"
1613
#endif
1714

18-
#if _MSC_VER <= 1900
19-
#undef TEST_EXPLICIT_IMBUE
20-
#endif
21-
#endif
22-
2315

2416
/****************************************************************************
2517
*
@@ -2405,6 +2397,17 @@ istream & operator>>(istream & is, EnumAB & val) {
24052397
void unitsTests() {
24062398
int line = 0;
24072399
CliTest cli;
2400+
#if defined(_MSC_VER) && _MSC_VER <= 1900
2401+
// Don't directly construct locale("en_US") in MSVC 2015 because of a bug
2402+
// in the locale implementation that may cause it to hang in debug builds.
2403+
setlocale(LC_ALL, "en_US");
2404+
EXPECT(true);
2405+
locale loc("");
2406+
EXPECT(true);
2407+
#else
2408+
locale loc("en_US");
2409+
EXPECT(true);
2410+
#endif
24082411

24092412
// si units
24102413
{
@@ -2482,15 +2485,6 @@ Units symbol 'k' not recognized.
24822485
EXPECT(*sv == "1000000");
24832486

24842487
auto & si = cli.opt<int>("i").siUnits();
2485-
#ifdef TEST_EXPLICIT_IMBUE
2486-
locale loc("en_US");
2487-
EXPECT(true);
2488-
#else
2489-
setlocale(LC_ALL, "en_US");
2490-
EXPECT(true);
2491-
locale loc("");
2492-
EXPECT(true);
2493-
#endif
24942488
si.imbue(loc);
24952489
EXPECT_PARSE(cli, "-i2G");
24962490
EXPECT(*si == 2'000'000'000);
@@ -2529,12 +2523,6 @@ Usage: test [OPTIONS] [V...]
25292523
{
25302524
cli = {};
25312525
auto & sht = cli.opt<uint16_t>("s").timeUnits();
2532-
#ifdef TEST_EXPLICIT_IMBUE
2533-
locale loc("en_US");
2534-
#else
2535-
setlocale(LC_ALL, "en_US");
2536-
locale loc("");
2537-
#endif
25382526
sht.imbue(loc);
25392527
EXPECT_HELP(cli, "", 1 + R"(
25402528
Usage: test [OPTIONS]
@@ -2573,7 +2561,7 @@ Must be between '0' and '65,535'.
25732561
EXPECT_PARSE(cli, "-v1ms -v1us -v1ns");
25742562
EXPECT(dbls[0] == 1e-3);
25752563
#if defined(_MSC_VER) && _MSC_VER != 1938
2576-
// Exclude these from MSVC 2022 17.8 because of bug in it's stream
2564+
// Exclude these from MSVC 2022 17.8 because of a bug in it's stream
25772565
// library.
25782566
EXPECT(dbls[1] == 1e-6);
25792567
EXPECT(dbls[2] == 1e-9);

0 commit comments

Comments
 (0)