[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lmi-commits] [lmi] master e4d2f31 08/33: Rename a function
From: |
Greg Chicares |
Subject: |
[lmi-commits] [lmi] master e4d2f31 08/33: Rename a function |
Date: |
Mon, 3 May 2021 08:15:51 -0400 (EDT) |
branch: master
commit e4d2f310b278893c74adae600ad9e6904149c5a6
Author: Gregory W. Chicares <gchicares@sbcglobal.net>
Commit: Gregory W. Chicares <gchicares@sbcglobal.net>
Rename a function
In commit d1f11ea63ee, squashed commit fcb817ca243
Don't refer to Boost.Filesystems in comments
removed this comment:
-/// Although portable_filename() would be a better name, that would be
-/// confusing because the boost filesystem library already provides
-/// boolean predicates like portable_file_name() [...]
Use that preferred name now, because there's no longer any reason to
avoid it.
---
ledger_pdf.cpp | 2 +-
path_utility.cpp | 6 +++---
path_utility.hpp | 2 +-
path_utility_test.cpp | 36 ++++++++++++++++++------------------
wx_test_validate_output.cpp | 6 +++---
5 files changed, 26 insertions(+), 26 deletions(-)
diff --git a/ledger_pdf.cpp b/ledger_pdf.cpp
index 3d2f57a..33a2f5f 100644
--- a/ledger_pdf.cpp
+++ b/ledger_pdf.cpp
@@ -46,7 +46,7 @@ std::string write_ledger_as_pdf(Ledger const& ledger,
fs::path const& filepath)
throw_if_interdicted(ledger);
fs::path print_dir(configurable_settings::instance().print_directory());
- // PDF !! Either orthodox_filename() should be used here, or its
+ // PDF !! Either portable_filename() should be used here, or its
// use should be reconsidered everywhere else.
fs::path pdf_out_file = unique_filepath(print_dir / filepath, ".pdf");
diff --git a/path_utility.cpp b/path_utility.cpp
index b013266..ee5d9d0 100644
--- a/path_utility.cpp
+++ b/path_utility.cpp
@@ -102,7 +102,7 @@ fs::path modify_directory
/// Crime and/or Punishment
/// with no intention of denoting a path.
-std::string orthodox_filename(std::string const& original_filename)
+std::string portable_filename(std::string const& original_filename)
{
LMI_ASSERT(!original_filename.empty());
std::string s(original_filename);
@@ -203,7 +203,7 @@ std::string serial_extension
/// Any extension or path is discarded from the input census filepath;
/// only the filename is used.
///
-/// It is necessary to call orthodox_filename() on the insured's name
+/// It is necessary to call portable_filename() on the insured's name
/// in case it contains a character (probably whitespace) that might
/// fail a std::filesystem name check.
@@ -222,7 +222,7 @@ fs::path serial_file_path
&& !global_settings::instance().regression_testing()
)
{
- s = '.' + orthodox_filename(personal_name) + s;
+ s = '.' + portable_filename(personal_name) + s;
}
return fs::path{exemplar}.filename().replace_extension(s);
}
diff --git a/path_utility.hpp b/path_utility.hpp
index f2ab7f8..6c3aa19 100644
--- a/path_utility.hpp
+++ b/path_utility.hpp
@@ -35,7 +35,7 @@ LMI_SO fs::path modify_directory
,fs::path const& supplied_directory
);
-LMI_SO std::string orthodox_filename
+LMI_SO std::string portable_filename
(std::string const& original_filename
);
diff --git a/path_utility_test.cpp b/path_utility_test.cpp
index c7ec637..ded5568 100644
--- a/path_utility_test.cpp
+++ b/path_utility_test.cpp
@@ -88,40 +88,40 @@ void test_modify_directory()
);
}
-void test_orthodox_filename()
+void test_portable_filename()
{
LMI_TEST_THROW
- (orthodox_filename("")
+ (portable_filename("")
,std::runtime_error
,"Assertion '!original_filename.empty()' failed."
);
- LMI_TEST_EQUAL("Z" , orthodox_filename("Z"));
- LMI_TEST_EQUAL("_" , orthodox_filename("."));
- LMI_TEST_EQUAL("_" , orthodox_filename("#"));
+ LMI_TEST_EQUAL("Z" , portable_filename("Z"));
+ LMI_TEST_EQUAL("_" , portable_filename("."));
+ LMI_TEST_EQUAL("_" , portable_filename("#"));
- LMI_TEST_EQUAL("AZ" , orthodox_filename("AZ"));
- LMI_TEST_EQUAL("A_" , orthodox_filename("A."));
- LMI_TEST_EQUAL("_Z" , orthodox_filename(".Z"));
- LMI_TEST_EQUAL("__" , orthodox_filename(".."));
- LMI_TEST_EQUAL("__" , orthodox_filename("##"));
+ LMI_TEST_EQUAL("AZ" , portable_filename("AZ"));
+ LMI_TEST_EQUAL("A_" , portable_filename("A."));
+ LMI_TEST_EQUAL("_Z" , portable_filename(".Z"));
+ LMI_TEST_EQUAL("__" , portable_filename(".."));
+ LMI_TEST_EQUAL("__" , portable_filename("##"));
- LMI_TEST_EQUAL("A.Z" , orthodox_filename("A.Z"));
- LMI_TEST_EQUAL("A-Z" , orthodox_filename("A-Z"));
+ LMI_TEST_EQUAL("A.Z" , portable_filename("A.Z"));
+ LMI_TEST_EQUAL("A-Z" , portable_filename("A-Z"));
- LMI_TEST_EQUAL("_xyz_" , orthodox_filename(".xyz."));
- LMI_TEST_EQUAL("_xyz_" , orthodox_filename("-xyz-"));
+ LMI_TEST_EQUAL("_xyz_" , portable_filename(".xyz."));
+ LMI_TEST_EQUAL("_xyz_" , portable_filename("-xyz-"));
- LMI_TEST_EQUAL("and_or", orthodox_filename("and/or"));
+ LMI_TEST_EQUAL("and_or", portable_filename("and/or"));
LMI_TEST_EQUAL
( "Crime_and_or_Punishment.text"
- ,orthodox_filename("Crime and/or Punishment.text")
+ ,portable_filename("Crime and/or Punishment.text")
);
LMI_TEST_EQUAL
( "_Fyodor_Dostoyevskiy_Crime_and_Punishment.text"
- ,orthodox_filename("/Fyodor Dostoyevskiy/Crime and Punishment.text")
+ ,portable_filename("/Fyodor Dostoyevskiy/Crime and Punishment.text")
);
}
@@ -459,7 +459,7 @@ void test_oddities()
int test_main(int, char*[])
{
test_modify_directory();
- test_orthodox_filename();
+ test_portable_filename();
test_serial_file_path();
test_unique_filepath_with_normal_filenames();
test_unique_filepath_with_ludicrous_filenames();
diff --git a/wx_test_validate_output.cpp b/wx_test_validate_output.cpp
index 090c333..27d434e 100644
--- a/wx_test_validate_output.cpp
+++ b/wx_test_validate_output.cpp
@@ -509,13 +509,13 @@ LMI_WX_TEST_CASE(validate_output_census)
// A variant of the insured name used to construct the file names.
//
- // It's not really clear whether we should be using orthodox_filename()
+ // It's not really clear whether we should be using portable_filename()
// here or just hardcode its result corresponding to the insured_name
// value: the latter would have the advantage of catching any bugs in
- // orthodox_filename() itself, but arguably we're not testing this function
+ // portable_filename() itself, but arguably we're not testing this function
// here and using it has the advantage of avoiding test breakages if this
// function behaviour is intentionally changed in the future.
- std::string const insured_filename = orthodox_filename(insured_name);
+ std::string const insured_filename = portable_filename(insured_name);
// Create, initialize and save the test census.
wx_test_new_census census;
- [lmi-commits] [lmi] master 6d7a545 26/33: Reinsert a required empty line, (continued)
- [lmi-commits] [lmi] master 6d7a545 26/33: Reinsert a required empty line, Greg Chicares, 2021/05/03
- [lmi-commits] [lmi] master ea4515f 04/33: Further deboostify, Greg Chicares, 2021/05/03
- [lmi-commits] [lmi] master 4faab10 01/33: Adjust whitespace for microconcinnity, Greg Chicares, 2021/05/03
- [lmi-commits] [lmi] master f4f4756 05/33: Resolve a marked defect [283], Greg Chicares, 2021/05/03
- [lmi-commits] [lmi] master c98c00d 10/33: Say "basename" rather than "leaf", Greg Chicares, 2021/05/03
- [lmi-commits] [lmi] master 1a68606 23/33: Conserve 80-character maximum width, Greg Chicares, 2021/05/03
- [lmi-commits] [lmi] master e33e392 22/33: Correct and reformat the modify_directory() documentation, Greg Chicares, 2021/05/03
- [lmi-commits] [lmi] master fd44389 03/33: Include appropriate headers, and say why they're included, Greg Chicares, 2021/05/03
- [lmi-commits] [lmi] master fdc0f5a 07/33: Deboostify even more, Greg Chicares, 2021/05/03
- [lmi-commits] [lmi] master 41274a8 14/33: Improve documentation, Greg Chicares, 2021/05/03
- [lmi-commits] [lmi] master e4d2f31 08/33: Rename a function,
Greg Chicares <=
- [lmi-commits] [lmi] master 2038991 15/33: Improve concinnity, Greg Chicares, 2021/05/03
- [lmi-commits] [lmi] master 9235f33 16/33: Avoid implicit conversion to fs::path, Greg Chicares, 2021/05/03
- [lmi-commits] [lmi] master 4ab2c4e 20/33: Further improve modify_directory() documentation, Greg Chicares, 2021/05/03
- [lmi-commits] [lmi] master b64436f 19/33: Improve modify_directory() documentation and tests, Greg Chicares, 2021/05/03
- [lmi-commits] [lmi] master 0e3d61a 21/33: Rework modify_directory() documentation; augment unit test, Greg Chicares, 2021/05/03
- [lmi-commits] [lmi] master 40096c3 24/33: Conserve 70-character comment width, Greg Chicares, 2021/05/03
- [lmi-commits] [lmi] master 4473403 29/33: Improve output spacing, Greg Chicares, 2021/05/03
- [lmi-commits] [lmi] master bc805ad 28/33: Augment path-validation unit test, Greg Chicares, 2021/05/03
- [lmi-commits] [lmi] master 6fd9f69 32/33: Remove the last occurrence of /name.check/, Greg Chicares, 2021/05/03
- [lmi-commits] [lmi] master 0c2d6b4 30/33: Revert "Revert "Trap exceptions from filesystem library"", Greg Chicares, 2021/05/03