Fixed test suite
This commit is contained in:
parent
89e4bb84ee
commit
63807f4c0a
@ -17,7 +17,6 @@ public class JSONScannerTest2 {
|
|||||||
@Test
|
@Test
|
||||||
public void stringHasSpecialTest() throws Throwable {
|
public void stringHasSpecialTest() throws Throwable {
|
||||||
JSONScanner scanner = new JSONScanner("\"\\b\\n\\t\\\"\\uABED\"");
|
JSONScanner scanner = new JSONScanner("\"\\b\\n\\t\\\"\\uABED\"");
|
||||||
// After construction the UTF-8 BOM should be safely skipped
|
|
||||||
scanner.nextToken();
|
scanner.nextToken();
|
||||||
Assert.assertEquals(JSONToken.LITERAL_STRING, scanner.token());
|
Assert.assertEquals(JSONToken.LITERAL_STRING, scanner.token());
|
||||||
Assert.assertEquals("\b\n\t\"\uABED", scanner.stringVal());
|
Assert.assertEquals("\b\n\t\"\uABED", scanner.stringVal());
|
||||||
@ -25,15 +24,13 @@ public class JSONScannerTest2 {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void stringWithIso8601Date() throws Throwable {
|
public void stringWithIso8601Date() throws Throwable {
|
||||||
JSONScanner scanner = new JSONScanner("2012-04-23T18:25:43.511Z");
|
JSONScanner scanner = new JSONScanner("2012-04-23T18:25:43.511Z");
|
||||||
// After construction the UTF-8 BOM should be safely skipped
|
|
||||||
Assert.assertTrue(scanner.scanISO8601DateIfMatch());
|
Assert.assertTrue(scanner.scanISO8601DateIfMatch());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void scanSingleComment() throws Throwable {
|
public void scanSingleComment() throws Throwable {
|
||||||
JSONScanner scanner = new JSONScanner("//dsajfklsjfk");
|
JSONScanner scanner = new JSONScanner("//dsajfklsjfk");
|
||||||
// After construction the UTF-8 BOM should be safely skipped
|
|
||||||
scanner.nextToken();
|
scanner.nextToken();
|
||||||
Assert.assertTrue(scanner.isEOF());
|
Assert.assertTrue(scanner.isEOF());
|
||||||
}
|
}
|
||||||
@ -41,7 +38,6 @@ public class JSONScannerTest2 {
|
|||||||
@Test
|
@Test
|
||||||
public void scanMultiComment() throws Throwable {
|
public void scanMultiComment() throws Throwable {
|
||||||
JSONScanner scanner = new JSONScanner("/*dsajfklsjfk*/");
|
JSONScanner scanner = new JSONScanner("/*dsajfklsjfk*/");
|
||||||
// After construction the UTF-8 BOM should be safely skipped
|
|
||||||
scanner.nextToken();
|
scanner.nextToken();
|
||||||
Assert.assertTrue(scanner.isEOF());
|
Assert.assertTrue(scanner.isEOF());
|
||||||
}
|
}
|
||||||
@ -55,27 +51,25 @@ public class JSONScannerTest2 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void inputTokenTest_Null() throws Throwable {
|
public void inputTokenTest_set() throws Throwable {
|
||||||
JSONScanner scanner = new JSONScanner("null");
|
JSONScanner scanner = new JSONScanner("Set[3,2,1]");
|
||||||
// After construction the UTF-8 BOM should be safely skipped
|
|
||||||
scanner.nextToken();
|
scanner.nextToken();
|
||||||
Assert.assertEquals(JSONToken.NULL, scanner.token());
|
Assert.assertEquals(JSONToken.SET, scanner.token());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void inputTokenTest_Undefined() throws Throwable {
|
public void inputTokenTest_Undefined() throws Throwable {
|
||||||
JSONScanner scanner = new JSONScanner("undefined");
|
JSONScanner scanner = new JSONScanner("undefined");
|
||||||
// After construction the UTF-8 BOM should be safely skipped
|
|
||||||
scanner.nextToken();
|
scanner.nextToken();
|
||||||
Assert.assertEquals(JSONToken.UNDEFINED, scanner.token());
|
Assert.assertEquals(JSONToken.UNDEFINED, scanner.token());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void inputTokenTest_Undefined() throws Throwable {
|
public void stringWithIso8601Date_Invalid() throws Throwable {
|
||||||
JSONScanner scanner = new JSONScanner("undefined");
|
Assert.assertTrue(new JSONScanner("2012-04-23T18:25:43.511Z").scanISO8601DateIfMatch());
|
||||||
// After construction the UTF-8 BOM should be safely skipped
|
Assert.assertFalse(new JSONScanner("2012-04-32T18:25:43.511Z").scanISO8601DateIfMatch());
|
||||||
scanner.nextToken();
|
Assert.assertFalse(new JSONScanner("2012-00-23T18:25:43.511Z").scanISO8601DateIfMatch());
|
||||||
Assert.assertEquals(JSONToken.UNDEFINED, scanner.token());
|
Assert.assertFalse(new JSONScanner("2012-13-23T18:25:43.511Z").scanISO8601DateIfMatch());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
Loading…
Reference in New Issue
Block a user