public void Spec01() { using (var instance = new JSLintContext()) { var result = instance.Lint("some invalid source"); I.Expect(result.Warnings).Not.ToBeEmpty(); } }
public void Spec03() { using (var instance = new JSLintContext()) { var result = instance.Lint( @"function sample(a, b, c, d) { 'use strict'; return arguments[3]; }", new JSLintOptions() { TolerateUnusedParameters = true }); I.Expect(result.Errors.Count).ToBe(1); } }
public void Spec02() { using (var instance = new JSLintContext()) { var result = instance.Lint( "var GLOBAL VARIABLE", new JSLintOptions() { MaximumErrors = 1 }); I.Expect(result.Warnings.Count).ToBe(2); I.Expect(result.Stop).ToBeTrue(); } }
public void Spec04() { using (var instance = new JSLintContext()) { var result = instance.Lint(@" var ValidSource = (function () { 'use strict'; return { memberProperty: 'value', memberFunction: function (arg) { return this.memberProperty + arg; } }; }());"); I.Expect(result.Errors).ToBeEmpty(); } }
public void Directives() { using (var instance = new JSLintContext()) { var result = instance.Lint(@" /*jslint browser*/ /*global require, define*/ /*property act, value*/ define(['service', 'bag'], function (service, bag) { 'use strict'; return service.act(bag.value); });"); I.Expect(result.Directives).Not.ToBeEmpty(); I.Expect(result.Directives[0].Directive).ToBe("jslint"); I.Expect(result.Directives[1].Directive).ToBe("global"); I.Expect(result.Directives[2].Directive).ToBe("property"); } }
public void Spec04() { using (var instance = new JSLintContext()) { var result = instance.Lint(@" var ValidSource = (function () { ""use strict""; var self = { memberProperty: ""value"" }; return { memberFunction: function (arg) { return self.memberProperty + arg; } }; }());"); I.Expect(result.Warnings).ToBeEmpty(); } }
public void Spec04() { using (var instance = new JSLintContext()) { var result = instance.Lint(@" var ValidSource = (function () { 'use strict'; var self = { memberProperty: 'value' }; return { memberFunction: function (arg) { return self.memberProperty + arg; } }; }());"); I.Expect(result.Warnings).ToBeEmpty(); } }
public void PropertyDirective() { using (var instance = new JSLintContext()) { var result = instance.Lint(@" var ValidSource = (function () { 'use strict'; var self = { memberProperty: 'value' }; return { memberFunction: function (arg) { return self.memberProperty + arg; } }; }());"); I.Expect(result.PropertyDirective).ToStartWith("/*property"); I.Expect(result.PropertyDirective).ToContain("memberFunction, memberProperty"); } }