Skip to content

Commit c80f093

Browse files
committed
Progress on #71 - Constructed labels
1 parent f129594 commit c80f093

2 files changed

Lines changed: 46 additions & 88 deletions

File tree

Tests.Common/Constructed/MakeLabel.cs

Lines changed: 4 additions & 88 deletions
Original file line numberDiff line numberDiff line change
@@ -7,100 +7,16 @@ namespace ExpressionToString.Tests {
77
public partial class ConstructedBase {
88
[Fact]
99
[Trait("Category", Labels)]
10-
public void ConstructLabel() => RunTest(
11-
// we're using variables here to force explicit blocks, which have indentation
12-
// in order to verify that the label is written without indentation
13-
Block(
14-
new[] { i },
15-
Block(
16-
new[] { j },
17-
Constant(true),
18-
Label(Label("target")),
19-
Constant(true)
20-
)
21-
),
22-
@"(
23-
int i,
24-
(
25-
int j,
26-
true,
27-
target:
28-
true
29-
)
30-
)",
31-
@"Block
32-
Dim i As Integer
33-
Block
34-
Dim j As Integer
35-
True
36-
target:
37-
True
38-
End Block
39-
End Block",
40-
@"Block(new[] { i },
41-
Block(new[] { j },
42-
Constant(true),
43-
Label(
44-
Label(""target""),
45-
null
46-
),
47-
Constant(true)
48-
)
49-
)"
50-
);
10+
public void ConstructLabel() => PreRunTest();
5111

5212
[Fact]
5313
[Trait("Category", Labels)]
54-
public void ConstructLabel1() => RunTest(
55-
Block(
56-
new[] { i },
57-
Block(
58-
new[] { j },
59-
Label(Label("target")),
60-
Constant(true)
61-
)
62-
),
63-
@"(
64-
int i,
65-
(
66-
int j,
67-
target:
68-
true
69-
)
70-
)",
71-
@"Block
72-
Dim i As Integer
73-
Block
74-
Dim j As Integer
75-
target:
76-
True
77-
End Block
78-
End Block",
79-
@"Block(new[] { i },
80-
Block(new[] { j },
81-
Label(
82-
Label(""target""),
83-
null
84-
),
85-
Constant(true)
86-
)
87-
)"
88-
);
14+
public void ConstructLabel1() => PreRunTest();
8915

9016
[Fact]
91-
public void ConstructLabelTarget() => RunTest(
92-
Label("target"),
93-
"target",
94-
"target",
95-
@"Label(""target"")"
96-
);
17+
public void ConstructLabelTarget() => PreRunTest();
9718

9819
[Fact]
99-
public void ConstructEmptyLabelTarget() => RunTest(
100-
Label(""),
101-
"",
102-
"",
103-
@"Label("""")"
104-
);
20+
public void ConstructEmptyLabelTarget() => PreRunTest();
10521
}
10622
}
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq.Expressions;
4+
using static ExpressionToString.Tests.Functions;
5+
using static ExpressionToString.Tests.Categories;
6+
using static System.Linq.Expressions.Expression;
7+
using static ExpressionToString.Tests.Globals;
8+
9+
namespace ExpressionToString.Tests.Objects {
10+
partial class FactoryMethods {
11+
12+
[Category(Labels)]
13+
// we're using variables here to force explicit blocks, which have indentation
14+
// in order to verify that the label is written without indentation
15+
public static readonly Expression ConstructLabel = Block(
16+
new[] { i },
17+
Block(
18+
new[] { j },
19+
Constant(true),
20+
Label(Label("target")),
21+
Constant(true)
22+
)
23+
);
24+
25+
[Category(Labels)]
26+
public static readonly Expression ConstructLabel1 = Block(
27+
new[] { i },
28+
Block(
29+
new[] { j },
30+
Label(Label("target")),
31+
Constant(true)
32+
)
33+
);
34+
35+
[Category(Labels)]
36+
public static readonly LabelTarget ConstructLabelTarget = Label("target");
37+
38+
[Category(Labels)]
39+
public static readonly LabelTarget ConstructEmptyLabelTarget = Label("");
40+
41+
}
42+
}

0 commit comments

Comments
 (0)