Beispiel #1
0
        public void TestGetTrimmedWhiteSpaceSplitIndex()
        {
            var result0 = StrHelper.GetWhiteSpaceSplittedStrArr("what.html \"\"saveBtn \"\"some \"\"matter");
            var result1 = StrHelper.GetWhiteSpaceSplittedStrArr("what.html \"\"saveBtn   \"\"some \"\"matter");

            Assert.True(result0.Count == 4);
            Assert.True(result1.Count == 4);
        }
        private string GetFilePathToInclude(string commandParamAndVars)
        {
            var fileInFilePathList = StrHelper.GetWhiteSpaceSplittedStrArr(commandParamAndVars);

            if (fileInFilePathList.Count >= 1)
            {
                var fileInFilePathFirst = fileInFilePathList[0];

                return(Path.Combine(OperationPath, fileInFilePathFirst));
            }

            return(null);
        }
        /// <summary>
        /// This method verifies if all html vars that should be handled in given file have the right prefix.
        /// </summary>
        private void VerifyVarCommands(string commandParamAndVars, out List <string> varParams)
        {
            varParams = StrHelper.GetWhiteSpaceSplittedStrArr(commandParamAndVars);
            if (varParams.Count > 1)
            {
                varParams.RemoveAt(0);
                foreach (var varParam in varParams)
                {
                    if (false == StrHelper.IsPrefixedByOneOfPrefixes(varParam, HtmlVarPrefixes))
                    {
                        throw new JsMrgRunnerException($"htmlvar var replacements have to start with either <''> or <\"\">, found: {varParam} in command {MatchInspection.Match.Value}");
                    }
                }
            }

            // Else: Nothing to do.
        }