use of com.cflint.api.CFLintResult in project CFLint by cflint.
the class TestCFBugs method testCFScriptIf.
@Test
public void testCFScriptIf() throws CFLintScanException {
final String cfcSrc = "<cfcomponent>\r\n" + "<cffunction name=\"rateBop\" >\r\n" + "<cfargument name=\"quote\">\r\n" + "\r\n" + "<cfscript>\r\n" + "if (xx) {\r\n" + "yy=123;\r\n" + "}else{\r\n" + "zz=123;\r\n" + "}\r\n" + "</cfscript>\r\n" + "</cffunction>" + "</cfcomponent>";
CFLintResult lintresult = cfBugs.scan(cfcSrc, "test");
List<BugInfo> result = lintresult.getIssues().values().iterator().next();
assertEquals(2, result.size());
}
use of com.cflint.api.CFLintResult in project CFLint by cflint.
the class TestCFBugs method testCFScriptAStruct.
@Test
public void testCFScriptAStruct() throws CFLintScanException {
final String cfcSrc = "<cfcomponent>\r\n" + "<cffunction name=\"func1\">\r\n" + " <cfscript>\r\n" + " var a = {};\r\n" + " a.response = processRequest(argumentCollection=arguments);\r\n" + " </cfscript>\r\n" + "</cffunction>" + "</cfcomponent>";
CFLintResult lintresult = cfBugs.scan(cfcSrc, "test");
assertEquals(0, lintresult.getIssues().size());
}
use of com.cflint.api.CFLintResult in project CFLint by cflint.
the class TestCFBugs method testMissingSemiTag.
@Test
public void testMissingSemiTag() throws CFLintScanException {
String src = "<cfcomponent>\n" + "<cfscript> function test() {\n" + " name_1 \n" + " name2 = \"Smith\"\n" + " last.name1 = \"Fred\"\n" + " }\n" + "</cfscript> </component>";
CFLintResult lintresult = cfBugs.scan(src, "test");
List<BugInfo> list = lintresult.getIssues().get("MISSING_SEMI");
assertNotNull(list);
assertEquals(1, list.size());
assertEquals(49, src.indexOf("name_1") + "name_1".length() - 1);
assertEquals(49, list.get(0).getOffset());
assertEquals(3, list.get(0).getLine());
assertEquals(6, list.get(0).getColumn());
}
use of com.cflint.api.CFLintResult in project CFLint by cflint.
the class TestCFBugs method testSimpleCFSETArg.
@Test
public void testSimpleCFSETArg() throws CFLintScanException {
final String cfcSrc = "<cfcomponent>\r\n" + "<cffunction name=\"test\">\r\n" + "<cfargument name=\"x\" default=\"\">\r\n" + " <cfif 1 EQ 1>\r\n" + " <cfset x=123/>\r\n" + " <cfset var y=123/>\r\n" + " </cfif>\r\n" + "</cffunction>\r\n" + "</cfcomponent>";
CFLintResult lintresult = cfBugs.scan(cfcSrc, "test");
Collection<List<BugInfo>> result = lintresult.getIssues().values();
assertEquals(0, result.size());
}
use of com.cflint.api.CFLintResult in project CFLint by cflint.
the class TestCFBugs method testMissingSemi.
@Test
public void testMissingSemi() throws CFLintScanException {
String src = "component {\n" + " function test() {\n" + " name_1 \n" + " name2 = \"Smith\"\n" + " last.name1 = \"Fred\"\n" + " }\n" + "}";
CFLintResult lintresult = cfBugs.scan(src, "test");
List<BugInfo> list = lintresult.getIssues().get("MISSING_SEMI");
assertNotNull(list);
assertEquals(1, list.size());
assertEquals(3, list.get(0).getLine());
assertEquals(8, list.get(0).getColumn());
assertEquals(39, src.indexOf("name_1") + "name_1".length() - 1);
assertEquals(39, list.get(0).getOffset());
}
Aggregations