-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix directory titles when underscores are present (#127)
- Loading branch information
Showing
14 changed files
with
384 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
######################################################################################## | ||
# This file is dedicated to the public domain. If your jurisdiction requires a # | ||
# specific license: # | ||
# # | ||
# Copyright (c) Stephen McDowell, 2017-2021 # | ||
# License: CC0 1.0 Universal # | ||
# License Text: https://creativecommons.org/publicdomain/zero/1.0/legalcode # | ||
######################################################################################## | ||
cmake_minimum_required(VERSION 3.13 FATAL_ERROR) | ||
project(cpp-dir-underscores LANGUAGES CXX) | ||
|
||
# "Header only library": add tests and include the directory | ||
target_sources(exhale-projects-unit-tests | ||
PUBLIC | ||
${CMAKE_CURRENT_SOURCE_DIR}/src/tests.cpp | ||
) | ||
target_include_directories(exhale-projects-tests-interface | ||
INTERFACE | ||
${CMAKE_CURRENT_SOURCE_DIR}/include | ||
) | ||
|
||
add_open_cpp_coverage_source_dirs(include src) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
""" | ||
The ``cpp_dir_underscores`` test project. | ||
It primarily exists to make sure directories with underscores in their titles | ||
get the correct link and title names (since exhale uses underscores internally). | ||
""" | ||
|
||
from testing.hierarchies import clike, directory, file, namespace | ||
|
||
|
||
def default_class_hierarchy_dict(): | ||
"""Return the default class hierarchy dictionar.""" | ||
return { | ||
namespace("interface_alpha"): { | ||
clike("struct", "Alpha"): {}, | ||
namespace("one_two_three"): { | ||
clike("struct", "OneTwoThree"): {}, | ||
}, | ||
namespace("four_five_six"): { | ||
clike("struct", "FourFiveSix"): {} | ||
} | ||
}, | ||
namespace("interface_beta"): { | ||
clike("struct", "Beta"): {} | ||
} | ||
} | ||
|
||
|
||
def default_file_hierarchy_dict(): | ||
"""Return the default file hierarchy dictionary.""" | ||
return { | ||
directory("include"): { | ||
directory("interface_alpha"): { | ||
file("alpha.hpp"): { | ||
namespace("interface_alpha"): { | ||
clike("struct", "Alpha"): {}, | ||
} | ||
}, | ||
directory("one_two_three"): { | ||
file("one_two_three.hpp"): { | ||
namespace("interface_alpha"): { | ||
namespace("one_two_three"): { | ||
clike("struct", "OneTwoThree"): {}, | ||
} | ||
} | ||
}, | ||
}, | ||
directory("__four_five_six__"): { | ||
file("__four_five_six__.hpp"): { | ||
namespace("interface_alpha"): { | ||
namespace("four_five_six"): { | ||
clike("struct", "FourFiveSix"): {} | ||
} | ||
} | ||
} | ||
} | ||
}, | ||
directory("interface_beta"): { | ||
file("beta.hpp"): { | ||
namespace("interface_beta"): { | ||
clike("struct", "Beta"): {} | ||
} | ||
} | ||
} | ||
} | ||
} |
22 changes: 22 additions & 0 deletions
22
...jects/cpp_dir_underscores/include/interface_alpha/__four_five_six__/__four_five_six__.hpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
/*************************************************************************************** | ||
* This file is dedicated to the public domain. If your jurisdiction requires a * | ||
* specific license: * | ||
* * | ||
* Copyright (c) Stephen McDowell, 2017-2021 * | ||
* License: CC0 1.0 Universal * | ||
* License Text: https://creativecommons.org/publicdomain/zero/1.0/legalcode * | ||
**************************************************************************************/ | ||
#pragma once | ||
|
||
#include <string> | ||
|
||
namespace interface_alpha { | ||
/// The ``four_five_six`` namespace. | ||
namespace four_five_six { | ||
/// The FourFiveSix struct. | ||
struct FourFiveSix { | ||
/// Returns ``"four_five_six"``. | ||
std::string id() const { return "four_five_six"; } | ||
}; | ||
} | ||
} |
20 changes: 20 additions & 0 deletions
20
testing/projects/cpp_dir_underscores/include/interface_alpha/alpha.hpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
/*************************************************************************************** | ||
* This file is dedicated to the public domain. If your jurisdiction requires a * | ||
* specific license: * | ||
* * | ||
* Copyright (c) Stephen McDowell, 2017-2021 * | ||
* License: CC0 1.0 Universal * | ||
* License Text: https://creativecommons.org/publicdomain/zero/1.0/legalcode * | ||
**************************************************************************************/ | ||
#pragma once | ||
|
||
#include <string> | ||
|
||
/// The ``interface_alpha`` namespace. | ||
namespace interface_alpha { | ||
/// The Alpha struct. | ||
struct Alpha { | ||
/// Returns ``"alpha"``. | ||
std::string id() const { return "alpha"; } | ||
}; | ||
} |
22 changes: 22 additions & 0 deletions
22
testing/projects/cpp_dir_underscores/include/interface_alpha/one_two_three/one_two_three.hpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
/*************************************************************************************** | ||
* This file is dedicated to the public domain. If your jurisdiction requires a * | ||
* specific license: * | ||
* * | ||
* Copyright (c) Stephen McDowell, 2017-2021 * | ||
* License: CC0 1.0 Universal * | ||
* License Text: https://creativecommons.org/publicdomain/zero/1.0/legalcode * | ||
**************************************************************************************/ | ||
#pragma once | ||
|
||
#include <string> | ||
|
||
namespace interface_alpha { | ||
/// The ``one_two_three`` namespace. | ||
namespace one_two_three { | ||
/// The OneTwoThree struct. | ||
struct OneTwoThree { | ||
/// Returns ``"one_two_three"``. | ||
std::string id() const { return "one_two_three"; } | ||
}; | ||
} | ||
} |
20 changes: 20 additions & 0 deletions
20
testing/projects/cpp_dir_underscores/include/interface_beta/beta.hpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
/*************************************************************************************** | ||
* This file is dedicated to the public domain. If your jurisdiction requires a * | ||
* specific license: * | ||
* * | ||
* Copyright (c) Stephen McDowell, 2017-2021 * | ||
* License: CC0 1.0 Universal * | ||
* License Text: https://creativecommons.org/publicdomain/zero/1.0/legalcode * | ||
**************************************************************************************/ | ||
#pragma once | ||
|
||
#include <string> | ||
|
||
/// The ``interface_beta`` namespace. | ||
namespace interface_beta { | ||
/// The Beta struct. | ||
struct Beta { | ||
/// Returns ``"beta"``. | ||
std::string id() const { return "beta"; } | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
/*************************************************************************************** | ||
* This file is dedicated to the public domain. If your jurisdiction requires a * | ||
* specific license: * | ||
* * | ||
* Copyright (c) Stephen McDowell, 2017-2021 * | ||
* License: CC0 1.0 Universal * | ||
* License Text: https://creativecommons.org/publicdomain/zero/1.0/legalcode * | ||
**************************************************************************************/ | ||
#include <catch2/catch.hpp> | ||
|
||
/* ================================================================================== */ | ||
|
||
#include <interface_alpha/alpha.hpp> | ||
TEST_CASE( "interface_alpha/alpha", "[cpp-dir-underscores]" ) { | ||
interface_alpha::Alpha alpha; | ||
REQUIRE( alpha.id() == "alpha" ); | ||
} | ||
|
||
/* ================================================================================== */ | ||
|
||
#include <interface_alpha/one_two_three/one_two_three.hpp> | ||
TEST_CASE( "interface_alpha/one_two_three", "[cpp-dir-underscores]") { | ||
interface_alpha::one_two_three::OneTwoThree ott; | ||
REQUIRE( ott.id() == "one_two_three" ); | ||
} | ||
|
||
/* ================================================================================== */ | ||
|
||
#include <interface_alpha/__four_five_six__/__four_five_six__.hpp> | ||
TEST_CASE( "interface_alpha/four_five_six", "[cpp-dir-underscores]") { | ||
interface_alpha::four_five_six::FourFiveSix ffs; | ||
REQUIRE( ffs.id() == "four_five_six" ); | ||
} | ||
|
||
/* ================================================================================== */ | ||
|
||
#include <interface_beta/beta.hpp> | ||
TEST_CASE( "interface_beta/beta", "[cpp-dir-underscores]") { | ||
interface_beta::Beta beta; | ||
REQUIRE( beta.id() == "beta" ); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.