package hudson.plugins.perforce;

import java.util.ArrayList;
import java.util.List;

import junit.framework.TestCase;

public class PerforceSCMHelperTest extends TestCase {
	
	public void testComputeChangesPathFromViews() {
		List<String> views;
		String path;
		views = new ArrayList<String>();
		path = PerforceSCMHelper.computePathFromViews(views);
		assertEquals("", path);
		views.clear();
		views.add("//xyz/... //Brian-xyz-hudproj/xyz/...");
		views.add("//xyz3/... //Brian-xyz-hudproj/xyz3/...");
		path = PerforceSCMHelper.computePathFromViews(views);
		assertEquals(path, "//xyz/... //xyz3/... ");
		views.clear();
		views.add("-//xyz3/... //Brian-xyz-hudproj/xyz3/...");
		path = PerforceSCMHelper.computePathFromViews(views);
		assertEquals("ignore exclusion paths, as they're not relevant for detecting changes", path, "");
		views.clear();
		views.add("\t//xyz3/... //Brian-xyz-hudproj/xyz3/...");
		path = PerforceSCMHelper.computePathFromViews(views);
		assertEquals("ignore leading tabs", path, "//xyz3/... ");
	}

}

@@ -218,16 +218,18 @@
 ews() %7B%0A
+//
 %09%09List%3CS
@@ -242,16 +242,18 @@
  views;%0A
+//
 %09%09String
@@ -259,16 +259,18 @@
 g path;%0A
+//
 %09%09views 
@@ -296,16 +296,18 @@
 ing%3E();%0A
+//
 %09%09path =
@@ -346,32 +346,34 @@
 omViews(views);%0A
+//
 %09%09assertEquals(%22
@@ -382,16 +382,18 @@
  path);%0A
+//
 %09%09views.
@@ -393,32 +393,34 @@
 %09views.clear();%0A
+//
 %09%09views.add(%22//x
@@ -453,24 +453,26 @@
 /xyz/...%22);%0A
+//
 %09%09views.add(
@@ -507,32 +507,34 @@
 roj/xyz3/...%22);%0A
+//
 %09%09path = Perforc
@@ -565,32 +565,34 @@
 omViews(views);%0A
+//
 %09%09assertEquals(p
@@ -618,24 +618,26 @@
 yz3/... %22);%0A
+//
 %09%09views.clea
@@ -633,32 +633,34 @@
 %09views.clear();%0A
+//
 %09%09views.add(%22-//
@@ -692,32 +692,34 @@
 roj/xyz3/...%22);%0A
+//
 %09%09path = Perforc
@@ -750,32 +750,34 @@
 omViews(views);%0A
+//
 %09%09assertEquals(%22
@@ -859,16 +859,18 @@
 h, %22%22);%0A
+//
 %09%09views.
@@ -878,16 +878,18 @@
 lear();%0A
+//
 %09%09views.
@@ -938,16 +938,18 @@
 /...%22);%0A
+//
 %09%09path =
@@ -996,16 +996,18 @@
 views);%0A
+//
 %09%09assert

fix build