yui/yui3 — pull request #1474 by customcommander (2013-12-08 16:06:34+00:00)
Title: Y.StringAssert

Hey guys,

I use YUI Test a lot at work and this PR is based on ideas I had when writing string assertions.

Even though string assertions are not the majority of the tests I write, they would have been a bit easier to write if I had the appropriate methods. But also the failure messages would have made more sense.

Examples:

```javascript
// before
"should start with foo": function () {
var str = "foobar";
Y.Assert.isTrue(str.indexOf("foo")==0);
}

// after
"should start with foo": function () {
Y.StringAssert.startsWith("foo", "foobar");
}

// before
"should only contains number": function () {
var re = /^[0-9]+$/
Y.Assert.isTrue(re.test("123"));
}

// after
"should only contains number": function () {
Y.StringAssert.matches(/^[0-9]+$/, "123");
}
```

This PR provides a new StringAssert class to the Test module with the following methods:

* isEmpty()
* isNotEmpty()
* isTrimmed()
* contains()
* doesNotContain()
* matches()
* doesNotMatch()
* startsWith()
* doesNotStartWith()
* endsWith()
* doesNotEndWith()

Also included in this PR:

* Unit tests for each method
* Update of the build configuration
* Update of the HISTORY
* User guide documentation

Thanks