[corlib] Fix tests for watchOS. (#3131)
[mono.git] / mcs / class / corlib / Test / System / EnvironmentTest.cs
index b511ccdcb12cccfbc4b968c39cba91c280d4425e..fed370974e584b8d5c33dd49eca0a75dc87de8e6 100644 (file)
@@ -5,6 +5,7 @@
 //     Sebastien Pouliot <sebastien@ximian.com>
 //
 // (C) 2004-2005 Novell (http://www.novell.com)
+// Copyright 2011 Xamarin Inc (http://www.xamarin.com).
 //
 
 using System;
@@ -118,6 +119,15 @@ namespace MonoTests.System
                        ExpandStartsEnds ("Hello %%PATH%%%", "Hello %", "%%");
                }
 
+               [Test]
+               // Bug #5169
+               public void ExpandEnvironmentVariables_ExpandMultiple ()
+               {
+                       string path = Environment.GetEnvironmentVariable ("PATH");
+                       var expected = "%TEST123" + path + "TEST456%";
+                       ExpandEquals ("%TEST123%PATH%TEST456%", expected);
+               }
+
                [Test]
                public void GetEnvironmentVariables ()
                {
@@ -128,9 +138,8 @@ namespace MonoTests.System
                        Assert.IsFalse (d.IsSynchronized, "IsSynchronized");
                }
 
-#if NET_2_0 && !TARGET_JVM
+#if !NET_2_1
                [Test] // bug #333740
-               [Category ("NotWorking")]
                public void GetEnvironmentVariables_NewlySet ()
                {
                        Environment.SetEnvironmentVariable ("MonoTestVariable", "TestValue");
@@ -147,12 +156,16 @@ namespace MonoTests.System
                public void GetCommandLineArgs ()
                {
                        string[] args = Environment.GetCommandLineArgs ();
+#if !__WATCHOS__
                        Assert.IsNotNull (args, "not null");
                        Assert.IsTrue (((args.Length > 0) && (args.Length < 256)), "reasonable");
                        Assert.IsNotNull (args [0], "application");
+#else
+                       Assert.AreEqual (0, args.Length, "length");
+#endif
                }
 
-#if NET_2_0
+#if !NET_2_1
                [Test]
                [ExpectedException (typeof (ArgumentException))]
                public void GetEnvironmentVariable_Target_Invalid ()
@@ -167,7 +180,6 @@ namespace MonoTests.System
                        Environment.GetEnvironmentVariables ((EnvironmentVariableTarget)Int32.MinValue);
                }
 
-#if !TARGET_JVM // Environment.SetEnvironmentVariable not supported under TARGET_JVM
                [Test]
                [ExpectedException (typeof (ArgumentException))]
                public void SetEnvironmentVariable_Target_Invalid ()
@@ -219,7 +231,6 @@ namespace MonoTests.System
                        Environment.SetEnvironmentVariable ("A3", "\0");
                        Assert.IsNull (Environment.GetEnvironmentVariables ()["A3"]);
                }
-#endif // TARGET_JVM
 #endif
        }
 }