Beispiel #1
0
        private void AddLast(TestCaseParseState state)
        {
            if (state == TestCaseParseState.FindingOpeningString)
            {
                return;
            }
            if ((state == TestCaseParseState.ReadingName) || (state == TestCaseParseState.ReadingTags))
            {
                WriteError(new FuspecParserError(FuspecErrorType.NoEndingTestCase, _inputText.Index));
            }

            if (!(_script.Any(x => x.Trim() != "")) && (state != TestCaseParseState.ReadingValues))
            {
                WriteError(new FuspecParserError(FuspecErrorType.NoEndingTestCase, _inputText.Index));
            }

            if (!(_script.Any(x => x.Trim() != "")))
            {
                WriteError(new FuspecParserError(FuspecErrorType.ScriptMissed, _inputText.Index));
            }

            else
            {
                BuildTestCase();
            }
        }
Beispiel #2
0
        private TestCaseParseState ReadNext(string str, TestCaseParseState testCaseParseState)
        {
            switch (testCaseParseState)
            {
            case TestCaseParseState.FindingOpeningString:
                return(FindOpeningString(str));

            case TestCaseParseState.ReadingName:
                return(FindName(str));

            case TestCaseParseState.ReadingTags:
                return(FindTags(str));

            case TestCaseParseState.ReadingBody:
                return(ReadBody(str));

            case TestCaseParseState.ReadingParamsIn:
                return(ReadParamsIn(str));

            case TestCaseParseState.ReadingParamsOut:
                return(ReadParamsOut(str));

            case TestCaseParseState.ReadingValues:
                return(ReadSetCheckValues(str));

            default:
                return(WriteError(new FuspecParserError(FuspecErrorType.Unknown, _inputText.Index)));
            }
        }
Beispiel #3
0
        private TestCaseParseState ReadSetCheckValues(string str)
        {
            TestCaseParseState parseState = TestCaseParseState.ReadingValues;

            if (_inputText.ISCurrentLineSeparated('*'))
            {
                return(AddTestCase(str));
            }

            var setString   = GetContentOrNullIfStartsFromKeyword("| set", str);
            var checkString = GetContentOrNullIfStartsFromKeyword("| check", str);

            if ((setString == null && checkString == null))
            {
                return(WriteError(new FuspecParserError(FuspecErrorType.ExpectedOpeningLine, _inputText.Index)));
            }

            if (setString != null)
            {
                parseState = AddSetCheckKitToSetCkecks(setString, new SetData());
                if (parseState != TestCaseParseState.ReadingValues)
                {
                    return(parseState);
                }
            }

            if (checkString != null)
            {
                parseState = AddSetCheckKitToSetCkecks(checkString, new CheckData());
            }
            return(parseState);
        }