mirror of
https://github.com/KeqingMoe/argparse.git
synced 2025-07-03 22:54:39 +00:00
update test to use module when WITH_MODULE macro is set
This commit is contained in:
parent
23aff1938a
commit
6723c81877
10
test/argparse_details.cppm
Normal file
10
test/argparse_details.cppm
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
module;
|
||||||
|
|
||||||
|
#include <argparse/argparse.hpp>
|
||||||
|
|
||||||
|
export module argparse.details;
|
||||||
|
|
||||||
|
export namespace argparse::details {
|
||||||
|
using argparse::details::repr;
|
||||||
|
}
|
||||||
|
|
@ -1,4 +1,8 @@
|
|||||||
|
#ifdef WITH_MODULE
|
||||||
|
import argparse;
|
||||||
|
#else
|
||||||
#include <argparse/argparse.hpp>
|
#include <argparse/argparse.hpp>
|
||||||
|
#endif
|
||||||
#include <doctest.hpp>
|
#include <doctest.hpp>
|
||||||
|
|
||||||
using doctest::test_suite;
|
using doctest::test_suite;
|
||||||
|
@ -1,6 +1,13 @@
|
|||||||
|
#ifdef WITH_MODULE
|
||||||
|
import argparse;
|
||||||
|
#else
|
||||||
#include <argparse/argparse.hpp>
|
#include <argparse/argparse.hpp>
|
||||||
|
#endif
|
||||||
#include <doctest.hpp>
|
#include <doctest.hpp>
|
||||||
|
|
||||||
|
#include <vector>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
using doctest::test_suite;
|
using doctest::test_suite;
|
||||||
|
|
||||||
TEST_CASE("Simplest .append" * test_suite("append")) {
|
TEST_CASE("Simplest .append" * test_suite("append")) {
|
||||||
|
@ -1,4 +1,8 @@
|
|||||||
|
#ifdef WITH_MODULE
|
||||||
|
import argparse;
|
||||||
|
#else
|
||||||
#include <argparse/argparse.hpp>
|
#include <argparse/argparse.hpp>
|
||||||
|
#endif
|
||||||
#include <doctest.hpp>
|
#include <doctest.hpp>
|
||||||
|
|
||||||
using doctest::test_suite;
|
using doctest::test_suite;
|
||||||
|
@ -1,4 +1,9 @@
|
|||||||
|
#ifdef WITH_MODULE
|
||||||
|
import argparse;
|
||||||
|
#else
|
||||||
#include <argparse/argparse.hpp>
|
#include <argparse/argparse.hpp>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <doctest.hpp>
|
#include <doctest.hpp>
|
||||||
|
|
||||||
using doctest::test_suite;
|
using doctest::test_suite;
|
||||||
|
@ -1,4 +1,8 @@
|
|||||||
|
#ifdef WITH_MODULE
|
||||||
|
import argparse;
|
||||||
|
#else
|
||||||
#include <argparse/argparse.hpp>
|
#include <argparse/argparse.hpp>
|
||||||
|
#endif
|
||||||
#include <doctest.hpp>
|
#include <doctest.hpp>
|
||||||
#include <test_utility.hpp>
|
#include <test_utility.hpp>
|
||||||
|
|
||||||
|
@ -1,4 +1,8 @@
|
|||||||
|
#ifdef WITH_MODULE
|
||||||
|
import argparse;
|
||||||
|
#else
|
||||||
#include <argparse/argparse.hpp>
|
#include <argparse/argparse.hpp>
|
||||||
|
#endif
|
||||||
#include <doctest.hpp>
|
#include <doctest.hpp>
|
||||||
|
|
||||||
using doctest::test_suite;
|
using doctest::test_suite;
|
||||||
|
@ -1,4 +1,8 @@
|
|||||||
|
#ifdef WITH_MODULE
|
||||||
|
import argparse;
|
||||||
|
#else
|
||||||
#include <argparse/argparse.hpp>
|
#include <argparse/argparse.hpp>
|
||||||
|
#endif
|
||||||
#include <doctest.hpp>
|
#include <doctest.hpp>
|
||||||
#include <test_utility.hpp>
|
#include <test_utility.hpp>
|
||||||
|
|
||||||
|
@ -1,7 +1,13 @@
|
|||||||
|
#ifdef WITH_MODULE
|
||||||
|
import argparse;
|
||||||
|
#else
|
||||||
#include <argparse/argparse.hpp>
|
#include <argparse/argparse.hpp>
|
||||||
|
#endif
|
||||||
#include <doctest.hpp>
|
#include <doctest.hpp>
|
||||||
|
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include <streambuf>
|
#include <streambuf>
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
using doctest::test_suite;
|
using doctest::test_suite;
|
||||||
|
|
||||||
|
@ -1,4 +1,8 @@
|
|||||||
|
#ifdef WITH_MODULE
|
||||||
|
import argparse;
|
||||||
|
#else
|
||||||
#include <argparse/argparse.hpp>
|
#include <argparse/argparse.hpp>
|
||||||
|
#endif
|
||||||
#include <doctest.hpp>
|
#include <doctest.hpp>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
|
@ -1,6 +1,14 @@
|
|||||||
|
#ifdef WITH_MODULE
|
||||||
|
import argparse;
|
||||||
|
#else
|
||||||
#include <argparse/argparse.hpp>
|
#include <argparse/argparse.hpp>
|
||||||
|
#endif
|
||||||
#include <doctest.hpp>
|
#include <doctest.hpp>
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
#include <vector>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
using doctest::test_suite;
|
using doctest::test_suite;
|
||||||
|
|
||||||
TEST_CASE("Basic --value=value" * test_suite("equals_form")) {
|
TEST_CASE("Basic --value=value" * test_suite("equals_form")) {
|
||||||
|
@ -1,6 +1,12 @@
|
|||||||
|
#ifdef WITH_MODULE
|
||||||
|
import argparse;
|
||||||
|
#else
|
||||||
#include <argparse/argparse.hpp>
|
#include <argparse/argparse.hpp>
|
||||||
|
#endif
|
||||||
#include <doctest.hpp>
|
#include <doctest.hpp>
|
||||||
|
|
||||||
|
#include <any>
|
||||||
|
|
||||||
using doctest::test_suite;
|
using doctest::test_suite;
|
||||||
|
|
||||||
TEST_CASE("Getting a simple argument" * test_suite("ArgumentParser::get")) {
|
TEST_CASE("Getting a simple argument" * test_suite("ArgumentParser::get")) {
|
||||||
|
@ -1,6 +1,12 @@
|
|||||||
|
#ifdef WITH_MODULE
|
||||||
|
import argparse;
|
||||||
|
#else
|
||||||
#include <argparse/argparse.hpp>
|
#include <argparse/argparse.hpp>
|
||||||
|
#endif
|
||||||
#include <doctest.hpp>
|
#include <doctest.hpp>
|
||||||
|
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
#include <optional>
|
||||||
|
|
||||||
using doctest::test_suite;
|
using doctest::test_suite;
|
||||||
|
|
||||||
|
@ -1,4 +1,8 @@
|
|||||||
|
#ifdef WITH_MODULE
|
||||||
|
import argparse;
|
||||||
|
#else
|
||||||
#include <argparse/argparse.hpp>
|
#include <argparse/argparse.hpp>
|
||||||
|
#endif
|
||||||
#include <doctest.hpp>
|
#include <doctest.hpp>
|
||||||
|
|
||||||
using doctest::test_suite;
|
using doctest::test_suite;
|
||||||
|
@ -1,4 +1,8 @@
|
|||||||
|
#ifdef WITH_MODULE
|
||||||
|
import argparse;
|
||||||
|
#else
|
||||||
#include <argparse/argparse.hpp>
|
#include <argparse/argparse.hpp>
|
||||||
|
#endif
|
||||||
#include <doctest.hpp>
|
#include <doctest.hpp>
|
||||||
|
|
||||||
using doctest::test_suite;
|
using doctest::test_suite;
|
||||||
|
@ -1,4 +1,8 @@
|
|||||||
|
#ifdef WITH_MODULE
|
||||||
|
import argparse;
|
||||||
|
#else
|
||||||
#include <argparse/argparse.hpp>
|
#include <argparse/argparse.hpp>
|
||||||
|
#endif
|
||||||
#include <doctest.hpp>
|
#include <doctest.hpp>
|
||||||
|
|
||||||
using doctest::test_suite;
|
using doctest::test_suite;
|
||||||
|
@ -1,4 +1,8 @@
|
|||||||
|
#ifdef WITH_MODULE
|
||||||
|
import argparse;
|
||||||
|
#else
|
||||||
#include <argparse/argparse.hpp>
|
#include <argparse/argparse.hpp>
|
||||||
|
#endif
|
||||||
#include <doctest.hpp>
|
#include <doctest.hpp>
|
||||||
|
|
||||||
using doctest::test_suite;
|
using doctest::test_suite;
|
||||||
|
@ -1,4 +1,8 @@
|
|||||||
|
#ifdef WITH_MODULE
|
||||||
|
import argparse;
|
||||||
|
#else
|
||||||
#include <argparse/argparse.hpp>
|
#include <argparse/argparse.hpp>
|
||||||
|
#endif
|
||||||
#include <doctest.hpp>
|
#include <doctest.hpp>
|
||||||
|
|
||||||
using doctest::test_suite;
|
using doctest::test_suite;
|
||||||
|
@ -1,4 +1,8 @@
|
|||||||
|
#ifdef WITH_MODULE
|
||||||
|
import argparse;
|
||||||
|
#else
|
||||||
#include <argparse/argparse.hpp>
|
#include <argparse/argparse.hpp>
|
||||||
|
#endif
|
||||||
#include <doctest.hpp>
|
#include <doctest.hpp>
|
||||||
|
|
||||||
using doctest::test_suite;
|
using doctest::test_suite;
|
||||||
|
@ -1,6 +1,12 @@
|
|||||||
|
#ifdef WITH_MODULE
|
||||||
|
import argparse;
|
||||||
|
#else
|
||||||
#include <argparse/argparse.hpp>
|
#include <argparse/argparse.hpp>
|
||||||
|
#endif
|
||||||
#include <doctest.hpp>
|
#include <doctest.hpp>
|
||||||
|
|
||||||
|
#include <optional>
|
||||||
|
|
||||||
using doctest::test_suite;
|
using doctest::test_suite;
|
||||||
|
|
||||||
TEST_CASE("Missing argument" * test_suite("parse_args")) {
|
TEST_CASE("Missing argument" * test_suite("parse_args")) {
|
||||||
|
@ -1,6 +1,13 @@
|
|||||||
|
#ifdef WITH_MODULE
|
||||||
|
import argparse;
|
||||||
|
#else
|
||||||
#include <argparse/argparse.hpp>
|
#include <argparse/argparse.hpp>
|
||||||
|
#endif
|
||||||
#include <doctest.hpp>
|
#include <doctest.hpp>
|
||||||
|
|
||||||
|
#include <vector>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
using doctest::test_suite;
|
using doctest::test_suite;
|
||||||
|
|
||||||
TEST_CASE("Parse unknown optional and positional arguments without exceptions" *
|
TEST_CASE("Parse unknown optional and positional arguments without exceptions" *
|
||||||
|
@ -1,4 +1,8 @@
|
|||||||
|
#ifdef WITH_MODULE
|
||||||
|
import argparse;
|
||||||
|
#else
|
||||||
#include <argparse/argparse.hpp>
|
#include <argparse/argparse.hpp>
|
||||||
|
#endif
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
#include <doctest.hpp>
|
#include <doctest.hpp>
|
||||||
|
|
||||||
|
@ -1,4 +1,8 @@
|
|||||||
|
#ifdef WITH_MODULE
|
||||||
|
import argparse;
|
||||||
|
#else
|
||||||
#include <argparse/argparse.hpp>
|
#include <argparse/argparse.hpp>
|
||||||
|
#endif
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
#include <doctest.hpp>
|
#include <doctest.hpp>
|
||||||
|
|
||||||
|
@ -1,6 +1,14 @@
|
|||||||
|
#ifdef WITH_MODULE
|
||||||
|
import argparse;
|
||||||
|
import argparse.details;
|
||||||
|
#else
|
||||||
#include <argparse/argparse.hpp>
|
#include <argparse/argparse.hpp>
|
||||||
|
#endif
|
||||||
#include <doctest.hpp>
|
#include <doctest.hpp>
|
||||||
|
|
||||||
#include <set>
|
#include <set>
|
||||||
|
#include <list>
|
||||||
|
#include <sstream>
|
||||||
|
|
||||||
using doctest::test_suite;
|
using doctest::test_suite;
|
||||||
|
|
||||||
|
@ -1,4 +1,8 @@
|
|||||||
|
#ifdef WITH_MODULE
|
||||||
|
import argparse;
|
||||||
|
#else
|
||||||
#include <argparse/argparse.hpp>
|
#include <argparse/argparse.hpp>
|
||||||
|
#endif
|
||||||
#include <doctest.hpp>
|
#include <doctest.hpp>
|
||||||
|
|
||||||
using doctest::test_suite;
|
using doctest::test_suite;
|
||||||
|
@ -1,4 +1,8 @@
|
|||||||
|
#ifdef WITH_MODULE
|
||||||
|
import argparse;
|
||||||
|
#else
|
||||||
#include <argparse/argparse.hpp>
|
#include <argparse/argparse.hpp>
|
||||||
|
#endif
|
||||||
#include <doctest.hpp>
|
#include <doctest.hpp>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
|
@ -1,7 +1,14 @@
|
|||||||
|
#ifdef WITH_MODULE
|
||||||
|
import argparse;
|
||||||
|
#else
|
||||||
#include <argparse/argparse.hpp>
|
#include <argparse/argparse.hpp>
|
||||||
#include <cmath>
|
#endif
|
||||||
#include <doctest.hpp>
|
#include <doctest.hpp>
|
||||||
|
|
||||||
|
#include <cmath>
|
||||||
|
#include <vector>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
using doctest::test_suite;
|
using doctest::test_suite;
|
||||||
|
|
||||||
TEST_CASE("Add subparsers" * test_suite("subparsers")) {
|
TEST_CASE("Add subparsers" * test_suite("subparsers")) {
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
#ifndef ARGPARSE_TEST_UTILITY_HPP
|
#ifndef ARGPARSE_TEST_UTILITY_HPP
|
||||||
#define ARGPARSE_TEST_UTILITY_HPP
|
#define ARGPARSE_TEST_UTILITY_HPP
|
||||||
|
|
||||||
|
#include <list>
|
||||||
|
|
||||||
namespace testutility {
|
namespace testutility {
|
||||||
// Get value at index from std::list
|
// Get value at index from std::list
|
||||||
template <typename T>
|
template <typename T>
|
||||||
|
@ -1,4 +1,8 @@
|
|||||||
|
#ifdef WITH_MODULE
|
||||||
|
import argparse;
|
||||||
|
#else
|
||||||
#include <argparse/argparse.hpp>
|
#include <argparse/argparse.hpp>
|
||||||
|
#endif
|
||||||
#include <doctest.hpp>
|
#include <doctest.hpp>
|
||||||
|
|
||||||
using doctest::test_suite;
|
using doctest::test_suite;
|
||||||
|
@ -1,4 +1,8 @@
|
|||||||
|
#ifdef WITH_MODULE
|
||||||
|
import argparse;
|
||||||
|
#else
|
||||||
#include <argparse/argparse.hpp>
|
#include <argparse/argparse.hpp>
|
||||||
|
#endif
|
||||||
#include <doctest.hpp>
|
#include <doctest.hpp>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user