Skip to content

Commit 341c8b7

Browse files
committed
1. Simplify project structure: Remove for_examples and integrate its data into example files
1 parent cf2f76c commit 341c8b7

File tree

6 files changed

+15
-15
lines changed

6 files changed

+15
-15
lines changed

examples/constmodule.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ fn main() {
2020
// if you need to change, for example, to (b,a) or substitute constant values,
2121
// we will only change the contents of the file "for_examples/full.tt"!
2222
__test_custom_path! {
23-
@ttest(T): [for_examples / "full" . t 't']; // this file contains "a, b", see "for_examples/full.tt"
23+
@ttest(T): [examples / "full" . t 't']; // this file contains "a, b", see "for_examples/full.tt"
2424
}
2525
assert_eq!(ttest::T, (0, 10));
2626
}

examples/full.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -44,32 +44,32 @@ fn main() {
4444
// Loading trees from a file and substituting them into a custom macro.
4545
include_tt! {
4646
test2_rules! {
47-
[#include!("./for_examples/full.tt")] // this file contains `a, b`.
48-
[#include! { "./for_examples/full.tt"}] // this file contains `a, b`.
47+
[#include!("./examples/full.tt")] // this file contains `a, b`.
48+
[#include! { "./examples/full.tt"}] // this file contains `a, b`.
4949
}
5050
test2_rules! {
51-
#include!("./for_examples/full.tt") // this file contains `a, b`.
51+
#include!("./examples/full.tt") // this file contains `a, b`.
5252
}
5353

5454
println!(
5555
concat!(
5656
"#",
57-
#include_str!("./for_examples/full.tt"), // this file contains `a, b`.
57+
#include_str!("./examples/full.tt"), // this file contains `a, b`.
5858
"#"
5959
)
6060
);
6161
}
6262

6363
{
6464
// Loading a string from a file.
65-
let str = include_tt!(#include_str!("./for_examples/full.tt")); // this file contains `a, b`.
65+
let str = include_tt!(#include_str!("./examples/full.tt")); // this file contains `a, b`.
6666
assert_eq!(str, "a, b");
6767
}
6868

6969
{
7070
// Loading an array from a file.
7171
let array: &'static [u8; 4] = include_tt!(
72-
#include_arr!("./for_examples/full.tt") // this file contains `a, b`.
72+
#include_arr!("./examples/full.tt") // this file contains `a, b`.
7373
);
7474
assert_eq!(array, b"a, b");
7575
}
@@ -85,7 +85,7 @@ fn main() {
8585
&mut end_str,
8686

8787
"arg1: {}, arg2: {}",
88-
#include!("./for_examples/full.tt") // this file contains `a, b`.
88+
#include!("./examples/full.tt") // this file contains `a, b`.
8989
);
9090
}
9191
assert_eq!(end_str, "arg1: 10, arg2: 20");
File renamed without changes.

examples/mrules.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ fn main() {
4141
// or
4242
// a - b = n
4343
test_rules! {
44-
#include!("./for_examples/mrules.tt") // this file contains "a + b = n", see "./for_examples/mrules.tt"
44+
#include!("./examples/mrules.tt") // this file contains "a + b = n", see "./for_examples/mrules.tt"
4545
}
4646
}
4747
assert_eq!(n, a + b);

src/lib.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ use std::fmt::Write;
5555
"arg1: {}, arg2: {}",
5656
5757
// This file contains `a, b`.
58-
#include!("./for_examples/full.tt") // this file contains `a, b`.
58+
#include!("./examples/full.tt") // this file contains `a, b`.
5959
);
6060
}
6161
@@ -66,7 +66,7 @@ use std::fmt::Write;
6666
{
6767
// Loading a string from "full.tt" using include_tt! macro.
6868
let str = include_tt!(
69-
#include_str!("./for_examples/full.tt") // this file contains `a, b`.
69+
#include_str!("./examples/full.tt") // this file contains `a, b`.
7070
);
7171
7272
// Asserting the result matches the expected output.
@@ -76,7 +76,7 @@ use std::fmt::Write;
7676
{
7777
// Loading a array from "full.tt" using include_tt! macro.
7878
let array: &'static [u8; 4] = include_tt!(
79-
#include_arr!("./for_examples/full.tt") // this file contains `a, b`.
79+
#include_arr!("./examples/full.tt") // this file contains `a, b`.
8080
);
8181
8282
// Asserting the result matches the expected output.
@@ -275,22 +275,22 @@ fn search_include_and_replacegroup(iter: &mut IterMut<'_, TokenTree2>) -> Search
275275
/// &mut end_str,
276276
///
277277
/// "arg1: {}, arg2: {}",
278-
/// #include!("./for_examples/full.tt") // this file contains `a, b`.
278+
/// #include!("./examples/full.tt") // this file contains `a, b`.
279279
/// );
280280
/// }
281281
/// assert_eq!(end_str, "arg1: 10, arg2: 20");
282282
/// }
283283
///
284284
/// {
285285
/// let str = include_tt!(
286-
/// #include_str!("./for_examples/full.tt") // this file contains `a, b`.
286+
/// #include_str!("./examples/full.tt") // this file contains `a, b`.
287287
/// );
288288
/// assert_eq!(str, "a, b");
289289
/// }
290290
///
291291
/// {
292292
/// let array: &'static [u8; 4] = include_tt!(
293-
/// #include_arr!("./for_examples/full.tt") // this file contains `a, b`.
293+
/// #include_arr!("./examples/full.tt") // this file contains `a, b`.
294294
/// );
295295
/// assert_eq!(array, b"a, b");
296296
/// }

0 commit comments

Comments
 (0)