[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lmi] Allowing TABs in (raw) strings in the source code
From: |
Vadim Zeitlin |
Subject: |
[lmi] Allowing TABs in (raw) strings in the source code |
Date: |
Sat, 5 Mar 2022 20:02:55 +0100 |
Hello,
I'd like to replace the ugly string currently used in the GUI paste census
unit case with a more readable and, also importantly for interactive
testing, immediately copy-and-pastable, raw string, i.e. do this:
---------------------------------- >8 --------------------------------------
diff --git a/wx_test_paste_census.cpp b/wx_test_paste_census.cpp
index 0178a5dfc..b4ed4f38b 100644
--- a/wx_test_paste_census.cpp
+++ b/wx_test_paste_census.cpp
@@ -204,16 +204,17 @@ std::string build_not_found_message(std::set<std::string>
const& remaining)
column_titles.insert("Specified Amount");
char const* const census_data =
- "Gender\tDateOfBirth\tEmployeeClass\tSpecifiedAmount\n"
- "\n"
- "Female\t19851231\tClerical\t100000, @85; 50000\n"
- "Male\t19801130\tClerical\t200000, @85; 50000\n"
- "Female\t19751029\tTechnical\t300000, @85; 50000\n"
- "Male\t19700928\tTechnical\t400000, @85; 50000\n"
- "Female\t19650827\tSupervisor\t500000, @85; 50000\n"
- "Male\t19600726\tAttorney\t600000, @85; 75000\n"
- "Female\t19550625\tPresident\t700000, @85; 100000\n"
- ;
+1 + R"--cut-here--(
+Gender DateOfBirth EmployeeClass SpecifiedAmount
+
+Female 19851231 Clerical 100000, @85; 50000
+Male 19801130 Clerical 200000, @85; 50000
+Female 19751029 Technical 300000, @85; 50000
+Male 19700928 Technical 400000, @85; 50000
+Female 19650827 Supervisor 500000, @85; 50000
+Male 19600726 Attorney 600000, @85; 75000
+Female 19550625 President 700000, @85; 100000
+)--cut-here--";
int const number_of_rows =
bourn_cast<int>
---------------------------------- >8 --------------------------------------
Unfortunately currently this would run afoul of the coding style checks as
they forbird the of raw TABs in the source code. This is, of course,
something that does generally make sense, but I think that TABs should be
allowed inside the string literals.
What should we do? I see the following answers:
0. Nothing. Just don't change anything and keep using C string.
1. Change test_coding_rules.cpp to allow TABs inside (raw) strings only.
2. Change test_coding_rules.cpp to allow TABs anywhere.
3. Use spaces rather than TABs in the source code and transform them
to TABs programmatically.
Ideal solution would be (1), but it's not that simple to do. But it's
doable, of course, if you think it's worth doing it. (2) is probably not
acceptable. (3) would be simple and might still worth it, but is not really
satisfactory. So is (0), i.e. nothing, the only thing to do here? Or
perhaps you have some better ideas?
Thanks in advance,
VZ
pgpU069fO6QB_.pgp
Description: PGP signature
- [lmi] Allowing TABs in (raw) strings in the source code,
Vadim Zeitlin <=