File tree Expand file tree Collapse file tree 2 files changed +24
-2
lines changed
source/fluentasserts/results/source Expand file tree Collapse file tree 2 files changed +24
-2
lines changed Original file line number Diff line number Diff line change @@ -35,12 +35,12 @@ auto getScope(const(Token)[] tokens, size_t line) nothrow {
3535 }
3636
3737 if (foundScope) {
38- if (token.text == " should" || token.text == " Assert" || type == " assert" || type == " ;" ) {
38+ if (! foundAssert && ( token.text == " should" || token.text == " Assert" || type == " assert" || type == " ;" ) ) {
3939 foundAssert = true ;
4040 scopeLevel = paranthesisCount;
4141 }
4242
43- if (type == " }" && paranthesisCount <= scopeLevel) {
43+ if (foundAssert && type == " }" && paranthesisCount < scopeLevel) {
4444 beginToken = paranthesisLevels[paranthesisCount];
4545 endToken = i + 1 ;
4646
@@ -112,3 +112,19 @@ unittest {
112112
113113}` );
114114}
115+
116+ @(" getScope returns full parent scope when it contains other nested blocks" )
117+ unittest {
118+ const (Token )[] tokens = [];
119+ splitMultilinetokens(fileToDTokens(" testdata/values.d" ), tokens);
120+
121+ auto result = getScope(tokens, 120 );
122+ auto identifierStart = getPreviousIdentifier(tokens, result.begin);
123+
124+ tokens[identifierStart .. result.end].tokensToString.strip.should.equal(` unittest {
125+ auto a = 1;
126+ a.shoud.equal(1);
127+ receive(2.seconds, (int m) { m.should.equal(1); });
128+
129+ }` );
130+ }
Original file line number Diff line number Diff line change @@ -114,3 +114,9 @@ unittest {
114114 a.should.equal(2 );
115115 }
116116}
117+
118+ unittest {
119+ auto a = 1 ;
120+ a.shoud.equal(1 );
121+ receive(2. seconds, (int m) { m.should.equal(1 ); });
122+ }
You can’t perform that action at this time.
0 commit comments