-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
281 additions
and
12 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,30 @@ | ||
// Copyright (c) 2024 Dr. Colin Hirsch and Daniel Frey | ||
// Please see LICENSE for license or visit https://github.com/taocpp/config/ | ||
|
||
#include <sstream> | ||
#include <string> | ||
|
||
#include "test.hpp" | ||
|
||
#include <tao/config.hpp> | ||
|
||
namespace tao::config | ||
{ | ||
const std::string s = "invalid json type 'object' for conversion to std::string [(root):1:1]"; // TODO: Where does the second space come from? | ||
|
||
void unit_test() | ||
{ | ||
const auto v = from_string( "foo = 42", __FUNCTION__ ); | ||
|
||
try { | ||
(void)v.as< std::string >(); | ||
++failed; | ||
} | ||
catch( const std::exception& e ) { | ||
TAO_CONFIG_TEST_ASSERT( e.what() == s ); | ||
} | ||
} | ||
|
||
} // namespace tao::config | ||
|
||
#include "main.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 @@ | ||
a = 1 b { c = 42 d = [ null, true ] e = (a.42.(b)) f = 'yo' g = -3 h = 3.14 i = (env "USER") j = $beef } c.* = 42 |
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,231 @@ | ||
{ | ||
position: "(root):1:1", | ||
object_data: { | ||
a: { | ||
remove: true, | ||
implicit: false, | ||
temporary: false, | ||
position: "tests/debug_traits.config:1:1", | ||
concat_list: [ | ||
{ | ||
type: "unsigned", | ||
data: 1 | ||
} | ||
] | ||
}, | ||
b: { | ||
remove: false, | ||
implicit: false, | ||
temporary: false, | ||
position: "tests/debug_traits.config:1:7", | ||
concat_list: [ | ||
{ | ||
type: "object", | ||
data: { | ||
position: "tests/debug_traits.config:1:9", | ||
object_data: { | ||
c: { | ||
remove: true, | ||
implicit: false, | ||
temporary: false, | ||
position: "tests/debug_traits.config:1:11", | ||
concat_list: [ | ||
{ | ||
type: "unsigned", | ||
data: 42 | ||
} | ||
] | ||
}, | ||
d: { | ||
remove: true, | ||
implicit: false, | ||
temporary: false, | ||
position: "tests/debug_traits.config:1:18", | ||
concat_list: [ | ||
{ | ||
type: "array", | ||
data: { | ||
position: "tests/debug_traits.config:1:22", | ||
function: "", | ||
array_data: [ | ||
{ | ||
remove: false, | ||
implicit: false, | ||
temporary: false, | ||
position: "tests/debug_traits.config:1:24", | ||
concat_list: [ | ||
{ | ||
type: "null" | ||
} | ||
] | ||
}, | ||
{ | ||
remove: false, | ||
implicit: false, | ||
temporary: false, | ||
position: "tests/debug_traits.config:1:24", | ||
concat_list: [ | ||
{ | ||
type: "boolean", | ||
data: true | ||
} | ||
] | ||
} | ||
] | ||
} | ||
} | ||
] | ||
}, | ||
e: { | ||
remove: true, | ||
implicit: false, | ||
temporary: false, | ||
position: "tests/debug_traits.config:1:37", | ||
concat_list: [ | ||
{ | ||
type: "reference", | ||
data: [ | ||
{ | ||
reference2_kind: "name", | ||
reference2_data: { | ||
index: 0, | ||
value: "a" | ||
}, | ||
position: "tests/debug_traits.config:1:42" | ||
}, | ||
{ | ||
reference2_kind: "index", | ||
reference2_data: { | ||
index: 1, | ||
value: 42 | ||
}, | ||
position: "tests/debug_traits.config:1:44" | ||
}, | ||
{ | ||
reference2_kind: "reference", | ||
reference2_data: { | ||
index: 2, | ||
value: [ | ||
{ | ||
reference2_kind: "name", | ||
reference2_data: { | ||
index: 0, | ||
value: "b" | ||
}, | ||
position: "tests/debug_traits.config:1:48" | ||
} | ||
] | ||
}, | ||
position: "tests/debug_traits.config:1:47" | ||
} | ||
] | ||
} | ||
] | ||
}, | ||
f: { | ||
remove: true, | ||
implicit: false, | ||
temporary: false, | ||
position: "tests/debug_traits.config:1:52", | ||
concat_list: [ | ||
{ | ||
type: "string", | ||
data: "yo" | ||
} | ||
] | ||
}, | ||
g: { | ||
remove: true, | ||
implicit: false, | ||
temporary: false, | ||
position: "tests/debug_traits.config:1:61", | ||
concat_list: [ | ||
{ | ||
type: "signed", | ||
data: -3 | ||
} | ||
] | ||
}, | ||
h: { | ||
remove: true, | ||
implicit: false, | ||
temporary: false, | ||
position: "tests/debug_traits.config:1:68", | ||
concat_list: [ | ||
{ | ||
type: "double", | ||
data: 3.14 | ||
} | ||
] | ||
}, | ||
i: { | ||
remove: true, | ||
implicit: false, | ||
temporary: false, | ||
position: "tests/debug_traits.config:1:77", | ||
concat_list: [ | ||
{ | ||
type: "array", | ||
data: { | ||
position: "tests/debug_traits.config:1:82", | ||
function: "env", | ||
array_data: [ | ||
{ | ||
remove: false, | ||
implicit: false, | ||
temporary: false, | ||
position: "tests/debug_traits.config:1:86", | ||
concat_list: [ | ||
{ | ||
type: "string", | ||
data: "USER" | ||
} | ||
] | ||
} | ||
] | ||
} | ||
} | ||
] | ||
}, | ||
j: { | ||
remove: true, | ||
implicit: false, | ||
temporary: false, | ||
position: "tests/debug_traits.config:1:94", | ||
concat_list: [ | ||
{ | ||
type: "binary", | ||
data: $BEEF | ||
} | ||
] | ||
} | ||
} | ||
} | ||
} | ||
] | ||
}, | ||
c: { | ||
remove: false, | ||
implicit: false, | ||
temporary: false, | ||
position: "tests/debug_traits.config:1:106", | ||
concat_list: [ | ||
{ | ||
type: "asterisk", | ||
data: { | ||
remove: true, | ||
implicit: false, | ||
temporary: false, | ||
position: "tests/debug_traits.config:1:108", | ||
concat_list: [ | ||
{ | ||
type: "unsigned", | ||
data: 42 | ||
} | ||
] | ||
} | ||
} | ||
] | ||
} | ||
} | ||
} |