Пример #1
0
            public void VariableInsideDoubleQuotedStringHasScriptExtentDefined(
                string input,
                string extentText,
                int startOffset,
                int endOffset,
                int startColumn,
                int endColumn,
                int startLine,
                int endLine)
            {
                ExpandableStringExpressionAst expandableStringAst = Parse(input);

                var variableAst = expandableStringAst.NestedExpressions.FirstOrDefault() as VariableExpressionAst;
                IScriptExtent extent = variableAst.Extent;

                var expectedExtent = new ExpectedScriptExtent
                {
                    Text = extentText,
                    StartOffset = startOffset,
                    EndOffset = endOffset,
                    StartColumnNumber = startColumn,
                    EndColumnNumber = endColumn,
                    StartLineNumber = startLine,
                    EndLineNumber = endLine
                };
                expectedExtent.AssertAreEqual(extent);
            }
Пример #2
0
            public void ExpandableStringVariableInsideDoubleQuotedStringHasExtentThatIncludesDoubleQuotes()
            {
                ExpandableStringExpressionAst expandableStringAst = Parse("\"$a\"");

                IScriptExtent extent = expandableStringAst.Extent;
                var expectedExtent = new ExpectedScriptExtent
                {
                    Text = "\"$a\"",
                    StartOffset = 0,
                    EndOffset = 4,
                    StartColumnNumber = 1,
                    EndColumnNumber = 5,
                    EndLineNumber = 1,
                    StartLineNumber = 1
                };
                expectedExtent.AssertAreEqual(extent);
            }