01: /*
02: * DelimiterDefinitionTest.java
03: *
04: * This file is part of SQL Workbench/J, http://www.sql-workbench.net
05: *
06: * Copyright 2002-2008, Thomas Kellerer
07: * No part of this code maybe reused without the permission of the author
08: *
09: * To contact the author please send an email to: support@sql-workbench.net
10: *
11: */
12: package workbench.sql;
13:
14: /**
15: *
16: * @author thomas
17: */
18: public class DelimiterDefinitionTest extends junit.framework.TestCase {
19:
20: public DelimiterDefinitionTest(String testName) {
21: super (testName);
22: }
23:
24: public void testDelimiter() {
25: try {
26: DelimiterDefinition d = new DelimiterDefinition();
27: assertEquals(true, d.isEmpty());
28: assertEquals(false, d.isSingleLine());
29:
30: d.setDelimiter(";");
31: assertEquals(true, d.isStandard());
32:
33: d.setDelimiter(" ; ");
34: assertEquals(true, d.isStandard());
35:
36: d = new DelimiterDefinition("/", true);
37: assertEquals(false, d.isStandard());
38: assertEquals(true, d.isSingleLine());
39:
40: d = new DelimiterDefinition(" / \n", true);
41: assertEquals("/", d.getDelimiter());
42: assertEquals(true, d.isSingleLine());
43: } catch (Exception e) {
44: e.printStackTrace();
45: fail(e.getMessage());
46: }
47: }
48:
49: public void testParse() {
50: try {
51: DelimiterDefinition d = DelimiterDefinition
52: .parseCmdLineArgument("/;nl");
53: assertEquals(false, d.isEmpty());
54: assertEquals(true, d.isSingleLine());
55: assertEquals("/", d.getDelimiter());
56:
57: d = DelimiterDefinition.parseCmdLineArgument("/;bla");
58: assertEquals(false, d.isEmpty());
59: assertEquals(false, d.isSingleLine());
60: assertEquals("/", d.getDelimiter());
61:
62: d = DelimiterDefinition.parseCmdLineArgument("/ ");
63: assertEquals(false, d.isEmpty());
64: assertEquals(false, d.isSingleLine());
65: assertEquals("/", d.getDelimiter());
66: } catch (Exception e) {
67: e.printStackTrace();
68: fail(e.getMessage());
69: }
70: }
71:
72: }
|