jiri: Add helper functions to envvar to manipulate token lists.

Renames {Prepend,Append}UsingSeparator to
{Prepend,Append}UniqueToken, and changes the semantics to also
filter away duplicate tokens.  The previous functions didn't seem
to provide much value over manually calling {Split,Join}Tokens.
The new functions provide a bit more functionalty wrapped into a
one-line call.

Also added UniqueTokens and FilterTokens, which help manipulate
slices of tokens.

Change-Id: Idf0f5a1f2cf88acf1e320326a328e3f2ec83fb55
MultiPart: 1/2
diff --git a/profiles/profilescmdline/manager_test.go b/profiles/profilescmdline/manager_test.go
index 0409849..ac82c59 100644
--- a/profiles/profilescmdline/manager_test.go
+++ b/profiles/profilescmdline/manager_test.go
@@ -108,7 +108,7 @@
 	defer cleanup()
 	dir, sh := buildInstallers(t), gosh.NewShell(t)
 	sh.Vars["JIRI_ROOT"] = fake.X.Root
-	sh.Vars["PATH"] = envvar.PrependUsingSeparator(dir, os.Getenv("PATH"), ":")
+	sh.Vars["PATH"] = envvar.PrependUniqueToken(sh.Vars["PATH"], ":", dir)
 	stdout := run(sh, dir, "jiri", "profile", "available", "-v")
 	for _, installer := range []string{"i1", "i2"} {
 		re := regexp.MustCompile("Available Subcommands:.*profile-" + installer + ".*\n")
@@ -185,7 +185,7 @@
 	defer cleanup()
 	dir, sh := buildInstallers(t), gosh.NewShell(t)
 	sh.Vars["JIRI_ROOT"] = fake.X.Root
-	sh.Vars["PATH"] = envvar.PrependUsingSeparator(dir, os.Getenv("PATH"), ":")
+	sh.Vars["PATH"] = envvar.PrependUniqueToken(sh.Vars["PATH"], ":", dir)
 
 	run(sh, dir, "jiri", "profile", "list", "-v")
 
@@ -286,6 +286,6 @@
 
 	dir, sh := buildJiri(t), gosh.NewShell(t)
 	sh.Vars["JIRI_ROOT"] = fake.X.Root
-	sh.Vars["PATH"] = envvar.PrependUsingSeparator(dir, os.Getenv("PATH"), ":")
+	sh.Vars["PATH"] = envvar.PrependUniqueToken(sh.Vars["PATH"], ":", dir)
 	run(sh, dir, "jiri", "profile", "list", "-v")
 }