<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[192774] trunk/Tools</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/192774">192774</a></dd>
<dt>Author</dt> <dd>ddkilzer@apple.com</dd>
<dt>Date</dt> <dd>2015-11-26 08:43:22 -0800 (Thu, 26 Nov 2015)</dd>
</dl>

<h3>Log Message</h3>
<pre>Extract prependToEnvironmentVariableList
&lt;http://webkit.org/b/151536&gt;

Reviewed by Daniel Bates.

Tests: webkitdirs_unittest/appendToEnvironmentVariableList.pl
       webkitdirs_unittest/prependToEnvironmentVariableList.pl

* Scripts/webkitdirs.pm: Export appendToEnvironmentVariableList
and prependToEnvironmentVariableList.
(appendToEnvironmentVariableList): Simplify variable name.
Switch to use $Config{path_sep}.
(prependToEnvironmentVariableList): Add new method.
(setupMacWebKitEnvironment): Switch to use
prependToEnvironmentVariableList().
(setupIOSWebKitEnvironment): Ditto.

* Scripts/webkitperl/webkitdirs_unittest/appendToEnvironmentVariableList.pl: Added.
* Scripts/webkitperl/webkitdirs_unittest/prependToEnvironmentVariableList.pl: Added.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkToolsChangeLog">trunk/Tools/ChangeLog</a></li>
<li><a href="#trunkToolsScriptswebkitdirspm">trunk/Tools/Scripts/webkitdirs.pm</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkToolsScriptswebkitperlwebkitdirs_unittestappendToEnvironmentVariableListpl">trunk/Tools/Scripts/webkitperl/webkitdirs_unittest/appendToEnvironmentVariableList.pl</a></li>
<li><a href="#trunkToolsScriptswebkitperlwebkitdirs_unittestprependToEnvironmentVariableListpl">trunk/Tools/Scripts/webkitperl/webkitdirs_unittest/prependToEnvironmentVariableList.pl</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkToolsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Tools/ChangeLog (192773 => 192774)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/ChangeLog        2015-11-26 13:52:45 UTC (rev 192773)
+++ trunk/Tools/ChangeLog        2015-11-26 16:43:22 UTC (rev 192774)
</span><span class="lines">@@ -1,3 +1,25 @@
</span><ins>+2015-11-26  David Kilzer  &lt;ddkilzer@apple.com&gt;
+
+        Extract prependToEnvironmentVariableList
+        &lt;http://webkit.org/b/151536&gt;
+
+        Reviewed by Daniel Bates.
+
+        Tests: webkitdirs_unittest/appendToEnvironmentVariableList.pl
+               webkitdirs_unittest/prependToEnvironmentVariableList.pl
+
+        * Scripts/webkitdirs.pm: Export appendToEnvironmentVariableList
+        and prependToEnvironmentVariableList.
+        (appendToEnvironmentVariableList): Simplify variable name.
+        Switch to use $Config{path_sep}.
+        (prependToEnvironmentVariableList): Add new method.
+        (setupMacWebKitEnvironment): Switch to use
+        prependToEnvironmentVariableList().
+        (setupIOSWebKitEnvironment): Ditto.
+
+        * Scripts/webkitperl/webkitdirs_unittest/appendToEnvironmentVariableList.pl: Added.
+        * Scripts/webkitperl/webkitdirs_unittest/prependToEnvironmentVariableList.pl: Added.
+
</ins><span class="cx"> 2015-11-22  Andy Estes  &lt;aestes@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Teach MiniBrowser how to enable the mock content filter
</span></span></pre></div>
<a id="trunkToolsScriptswebkitdirspm"></a>
<div class="modfile"><h4>Modified: trunk/Tools/Scripts/webkitdirs.pm (192773 => 192774)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/Scripts/webkitdirs.pm        2015-11-26 13:52:45 UTC (rev 192773)
+++ trunk/Tools/Scripts/webkitdirs.pm        2015-11-26 16:43:22 UTC (rev 192774)
</span><span class="lines">@@ -58,6 +58,7 @@
</span><span class="cx">        &amp;XcodeOptions
</span><span class="cx">        &amp;XcodeStaticAnalyzerOption
</span><span class="cx">        &amp;appDisplayNameFromBundle
</span><ins>+       &amp;appendToEnvironmentVariableList
</ins><span class="cx">        &amp;baseProductDir
</span><span class="cx">        &amp;chdirWebKit
</span><span class="cx">        &amp;checkFrameworks
</span><span class="lines">@@ -70,6 +71,7 @@
</span><span class="cx">        &amp;iosSimulatorDeviceByName
</span><span class="cx">        &amp;nmPath
</span><span class="cx">        &amp;passedConfiguration
</span><ins>+       &amp;prependToEnvironmentVariableList
</ins><span class="cx">        &amp;printHelpAndExitForRunAndDebugWebKitAppIfNeeded
</span><span class="cx">        &amp;productDir
</span><span class="cx">        &amp;quitIOSSimulator
</span><span class="lines">@@ -1377,17 +1379,28 @@
</span><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-sub appendToEnvironmentVariableList
</del><ins>+sub appendToEnvironmentVariableList($$)
</ins><span class="cx"> {
</span><del>-    my ($environmentVariableName, $value) = @_;
</del><ins>+    my ($name, $value) = @_;
</ins><span class="cx"> 
</span><del>-    if (defined($ENV{$environmentVariableName})) {
-        $ENV{$environmentVariableName} .= &quot;:&quot; . $value;
</del><ins>+    if (defined($ENV{$name})) {
+        $ENV{$name} .= $Config{path_sep} . $value;
</ins><span class="cx">     } else {
</span><del>-        $ENV{$environmentVariableName} = $value;
</del><ins>+        $ENV{$name} = $value;
</ins><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+sub prependToEnvironmentVariableList($$)
+{
+    my ($name, $value) = @_;
+
+    if (defined($ENV{$name})) {
+        $ENV{$name} = $value . $Config{path_sep} . $ENV{$name};
+    } else {
+        $ENV{$name} = $value;
+    }
+}
+
</ins><span class="cx"> sub sharedCommandLineOptions()
</span><span class="cx"> {
</span><span class="cx">     return (
</span><span class="lines">@@ -2150,8 +2163,8 @@
</span><span class="cx"> 
</span><span class="cx">     $dyldFrameworkPath = File::Spec-&gt;rel2abs($dyldFrameworkPath);
</span><span class="cx"> 
</span><del>-    $ENV{DYLD_FRAMEWORK_PATH} = $ENV{DYLD_FRAMEWORK_PATH} ? join(&quot;:&quot;, $dyldFrameworkPath, $ENV{DYLD_FRAMEWORK_PATH}) : $dyldFrameworkPath;
-    $ENV{__XPC_DYLD_FRAMEWORK_PATH} = $dyldFrameworkPath;
</del><ins>+    prependToEnvironmentVariableList(&quot;DYLD_FRAMEWORK_PATH&quot;, $dyldFrameworkPath);
+    prependToEnvironmentVariableList(&quot;__XPC_DYLD_FRAMEWORK_PATH&quot;, $dyldFrameworkPath);
</ins><span class="cx">     $ENV{WEBKIT_UNSET_DYLD_FRAMEWORK_PATH} = &quot;YES&quot;;
</span><span class="cx"> 
</span><span class="cx">     setUpGuardMallocIfNeeded();
</span><span class="lines">@@ -2162,8 +2175,8 @@
</span><span class="cx">     my ($dyldFrameworkPath) = @_;
</span><span class="cx">     $dyldFrameworkPath = File::Spec-&gt;rel2abs($dyldFrameworkPath);
</span><span class="cx"> 
</span><del>-    $ENV{DYLD_FRAMEWORK_PATH} = $dyldFrameworkPath;
-    $ENV{DYLD_LIBRARY_PATH} = $dyldFrameworkPath;
</del><ins>+    prependToEnvironmentVariableList(&quot;DYLD_FRAMEWORK_PATH&quot;, $dyldFrameworkPath);
+    prependToEnvironmentVariableList(&quot;DYLD_LIBRARY_PATH&quot;, $dyldFrameworkPath);
</ins><span class="cx"> 
</span><span class="cx">     setUpGuardMallocIfNeeded();
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkToolsScriptswebkitperlwebkitdirs_unittestappendToEnvironmentVariableListpl"></a>
<div class="addfile"><h4>Added: trunk/Tools/Scripts/webkitperl/webkitdirs_unittest/appendToEnvironmentVariableList.pl (0 => 192774)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/Scripts/webkitperl/webkitdirs_unittest/appendToEnvironmentVariableList.pl                                (rev 0)
+++ trunk/Tools/Scripts/webkitperl/webkitdirs_unittest/appendToEnvironmentVariableList.pl        2015-11-26 16:43:22 UTC (rev 192774)
</span><span class="lines">@@ -0,0 +1,102 @@
</span><ins>+#!/usr/bin/perl -w
+
+# Copyright (C) 2015 Apple Inc. All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1.  Redistributions of source code must retain the above copyright
+#     notice, this list of conditions and the following disclaimer.
+# 2.  Redistributions in binary form must reproduce the above copyright
+#     notice, this list of conditions and the following disclaimer in the
+#     documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
+# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+# DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+# Unit tests for webkitdirs::appendToEnvironmentVariableList($$).
+
+use strict;
+use warnings;
+
+use Config;
+use Test::More;
+use webkitdirs;
+
+my @testCases = (
+{
+    setup =&gt; sub { delete $ENV{DYLD_FRAMEWORK_PATH}; },
+    argName =&gt; &quot;DYLD_FRAMEWORK_PATH&quot;,
+    argValue =&gt; &quot;/System/Library/PrivateFrameworks&quot;,
+    expectedValue =&gt; &quot;/System/Library/PrivateFrameworks&quot;,
+    description =&gt; &quot;Append to nonexistent variable&quot;,
+},
+{
+    setup =&gt; sub { $ENV{DYLD_FRAMEWORK_PATH} = undef; },
+    argName =&gt; &quot;DYLD_FRAMEWORK_PATH&quot;,
+    argValue =&gt; &quot;/System/Library/PrivateFrameworks&quot;,
+    expectedValue =&gt; &quot;/System/Library/PrivateFrameworks&quot;,
+    description =&gt; &quot;Append to undefined variable&quot;,
+},
+{
+    setup =&gt; sub { $ENV{DYLD_FRAMEWORK_PATH} = &quot;&quot;; },
+    argName =&gt; &quot;DYLD_FRAMEWORK_PATH&quot;,
+    argValue =&gt; &quot;/System/Library/PrivateFrameworks&quot;,
+    expectedValue =&gt; join($Config{path_sep}, &quot;&quot;, &quot;/System/Library/PrivateFrameworks&quot;),
+    description =&gt; &quot;Append to empty path&quot;,
+},
+{
+    setup =&gt; sub { $ENV{DYLD_FRAMEWORK_PATH} = $Config{path_sep}; },
+    argName =&gt; &quot;DYLD_FRAMEWORK_PATH&quot;,
+    argValue =&gt; &quot;/System/Library/PrivateFrameworks&quot;,
+    expectedValue =&gt; join($Config{path_sep}, &quot;&quot;, &quot;&quot;, &quot;/System/Library/PrivateFrameworks&quot;),
+    description =&gt; &quot;Append to empty path with separator&quot;,
+},
+{
+    setup =&gt; sub { $ENV{DYLD_FRAMEWORK_PATH} = &quot;/System/Library/Frameworks&quot;; },
+    argName =&gt; &quot;DYLD_FRAMEWORK_PATH&quot;,
+    argValue =&gt; &quot;/System/Library/PrivateFrameworks&quot;,
+    expectedValue =&gt; join($Config{path_sep}, &quot;/System/Library/Frameworks&quot;, &quot;/System/Library/PrivateFrameworks&quot;),
+    description =&gt; &quot;Append to single path with no separator&quot;,
+},
+{
+    setup =&gt; sub { $ENV{DYLD_FRAMEWORK_PATH} = &quot;/System/Library/Frameworks&quot; . $Config{path_sep}; },
+    argName =&gt; &quot;DYLD_FRAMEWORK_PATH&quot;,
+    argValue =&gt; &quot;/System/Library/PrivateFrameworks&quot;,
+    expectedValue =&gt; join($Config{path_sep}, &quot;/System/Library/Frameworks&quot;, &quot;&quot;, &quot;/System/Library/PrivateFrameworks&quot;),
+    description =&gt; &quot;Append to single path with separator&quot;,
+},
+{
+    setup =&gt; sub { $ENV{DYLD_FRAMEWORK_PATH} = &quot;/System/Library/Frameworks&quot; . $Config{path_sep} . &quot;/System/Library/PrivateFrameworks&quot;; },
+    argName =&gt; &quot;DYLD_FRAMEWORK_PATH&quot;,
+    argValue =&gt; &quot;/System/Library/PrivateFrameworks&quot;,
+    expectedValue =&gt; join($Config{path_sep}, &quot;/System/Library/Frameworks&quot;, &quot;/System/Library/PrivateFrameworks&quot;, &quot;/System/Library/PrivateFrameworks&quot;),
+    description =&gt; &quot;Append to multiple, duplicate path with no separator&quot;,
+},
+{
+    setup =&gt; sub { $ENV{DYLD_FRAMEWORK_PATH} = &quot;/System/Library/Frameworks&quot; . $Config{path_sep} . &quot;/System/Library/PrivateFrameworks&quot; . $Config{path_sep}; },
+    argName =&gt; &quot;DYLD_FRAMEWORK_PATH&quot;,
+    argValue =&gt; &quot;/System/Library/PrivateFrameworks&quot;,
+    expectedValue =&gt; join($Config{path_sep}, &quot;/System/Library/Frameworks&quot;, &quot;/System/Library/PrivateFrameworks&quot;, &quot;&quot;, &quot;/System/Library/PrivateFrameworks&quot;),
+    description =&gt; &quot;Append to multiple, duplicate path with separator&quot;,
+},
+);
+
+plan(tests =&gt; 2 * @testCases);
+
+foreach my $testCase (@testCases) {
+    local %ENV;
+    $testCase-&gt;{setup}-&gt;();
+    my $result = appendToEnvironmentVariableList($testCase-&gt;{argName}, $testCase-&gt;{argValue});
+    is_deeply($result, $testCase-&gt;{expectedValue}, &quot;appendToEnvironmentVariableList: $testCase-&gt;{description} - return result&quot;);
+    is_deeply($testCase-&gt;{expectedValue}, $ENV{$testCase-&gt;{argName}}, &quot;appendToEnvironmentVariableList: $testCase-&gt;{description} - environment variable value&quot;);
+}
+
</ins></span></pre></div>
<a id="trunkToolsScriptswebkitperlwebkitdirs_unittestprependToEnvironmentVariableListpl"></a>
<div class="addfile"><h4>Added: trunk/Tools/Scripts/webkitperl/webkitdirs_unittest/prependToEnvironmentVariableList.pl (0 => 192774)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/Scripts/webkitperl/webkitdirs_unittest/prependToEnvironmentVariableList.pl                                (rev 0)
+++ trunk/Tools/Scripts/webkitperl/webkitdirs_unittest/prependToEnvironmentVariableList.pl        2015-11-26 16:43:22 UTC (rev 192774)
</span><span class="lines">@@ -0,0 +1,102 @@
</span><ins>+#!/usr/bin/perl -w
+
+# Copyright (C) 2015 Apple Inc. All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1.  Redistributions of source code must retain the above copyright
+#     notice, this list of conditions and the following disclaimer.
+# 2.  Redistributions in binary form must reproduce the above copyright
+#     notice, this list of conditions and the following disclaimer in the
+#     documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
+# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+# DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+# Unit tests for webkitdirs::prependToEnvironmentVariableList($$).
+
+use strict;
+use warnings;
+
+use Config;
+use Test::More;
+use webkitdirs;
+
+my @testCases = (
+{
+    setup =&gt; sub { delete $ENV{DYLD_FRAMEWORK_PATH}; },
+    argName =&gt; &quot;DYLD_FRAMEWORK_PATH&quot;,
+    argValue =&gt; &quot;/System/Library/PrivateFrameworks&quot;,
+    expectedValue =&gt; &quot;/System/Library/PrivateFrameworks&quot;,
+    description =&gt; &quot;Prepend to nonexistent variable&quot;,
+},
+{
+    setup =&gt; sub { $ENV{DYLD_FRAMEWORK_PATH} = undef; },
+    argName =&gt; &quot;DYLD_FRAMEWORK_PATH&quot;,
+    argValue =&gt; &quot;/System/Library/PrivateFrameworks&quot;,
+    expectedValue =&gt; &quot;/System/Library/PrivateFrameworks&quot;,
+    description =&gt; &quot;Prepend to undefined variable&quot;,
+},
+{
+    setup =&gt; sub { $ENV{DYLD_FRAMEWORK_PATH} = &quot;&quot;; },
+    argName =&gt; &quot;DYLD_FRAMEWORK_PATH&quot;,
+    argValue =&gt; &quot;/System/Library/PrivateFrameworks&quot;,
+    expectedValue =&gt; join($Config{path_sep}, &quot;/System/Library/PrivateFrameworks&quot;, &quot;&quot;),
+    description =&gt; &quot;Prepend to empty path&quot;,
+},
+{
+    setup =&gt; sub { $ENV{DYLD_FRAMEWORK_PATH} = $Config{path_sep}; },
+    argName =&gt; &quot;DYLD_FRAMEWORK_PATH&quot;,
+    argValue =&gt; &quot;/System/Library/PrivateFrameworks&quot;,
+    expectedValue =&gt; join($Config{path_sep}, &quot;/System/Library/PrivateFrameworks&quot;, &quot;&quot;, &quot;&quot;),
+    description =&gt; &quot;Prepend to empty path with separator&quot;,
+},
+{
+    setup =&gt; sub { $ENV{DYLD_FRAMEWORK_PATH} = &quot;/System/Library/Frameworks&quot;; },
+    argName =&gt; &quot;DYLD_FRAMEWORK_PATH&quot;,
+    argValue =&gt; &quot;/System/Library/PrivateFrameworks&quot;,
+    expectedValue =&gt; join($Config{path_sep}, &quot;/System/Library/PrivateFrameworks&quot;, &quot;/System/Library/Frameworks&quot;),
+    description =&gt; &quot;Prepend to single path with no separator&quot;,
+},
+{
+    setup =&gt; sub { $ENV{DYLD_FRAMEWORK_PATH} = $Config{path_sep} . &quot;/System/Library/Frameworks&quot;; },
+    argName =&gt; &quot;DYLD_FRAMEWORK_PATH&quot;,
+    argValue =&gt; &quot;/System/Library/PrivateFrameworks&quot;,
+    expectedValue =&gt; join($Config{path_sep}, &quot;/System/Library/PrivateFrameworks&quot;, &quot;&quot;, &quot;/System/Library/Frameworks&quot;),
+    description =&gt; &quot;Prepend to single path with separator&quot;,
+},
+{
+    setup =&gt; sub { $ENV{DYLD_FRAMEWORK_PATH} = &quot;/System/Library/Frameworks&quot; . $Config{path_sep} . &quot;/System/Library/PrivateFrameworks&quot;; },
+    argName =&gt; &quot;DYLD_FRAMEWORK_PATH&quot;,
+    argValue =&gt; &quot;/System/Library/PrivateFrameworks&quot;,
+    expectedValue =&gt; join($Config{path_sep}, &quot;/System/Library/PrivateFrameworks&quot;, &quot;/System/Library/Frameworks&quot;, &quot;/System/Library/PrivateFrameworks&quot;),
+    description =&gt; &quot;Prepend to multiple, duplicate path with no separator&quot;,
+},
+{
+    setup =&gt; sub { $ENV{DYLD_FRAMEWORK_PATH} = $Config{path_sep} . &quot;/System/Library/Frameworks&quot; . $Config{path_sep} . &quot;/System/Library/PrivateFrameworks&quot;; },
+    argName =&gt; &quot;DYLD_FRAMEWORK_PATH&quot;,
+    argValue =&gt; &quot;/System/Library/PrivateFrameworks&quot;,
+    expectedValue =&gt; join($Config{path_sep}, &quot;/System/Library/PrivateFrameworks&quot;, &quot;&quot;, &quot;/System/Library/Frameworks&quot;, &quot;/System/Library/PrivateFrameworks&quot;),
+    description =&gt; &quot;Prepend to multiple, duplicate path with separator&quot;,
+},
+);
+
+plan(tests =&gt; 2 * @testCases);
+
+foreach my $testCase (@testCases) {
+    local %ENV;
+    $testCase-&gt;{setup}-&gt;();
+    my $result = prependToEnvironmentVariableList($testCase-&gt;{argName}, $testCase-&gt;{argValue});
+    is_deeply($result, $testCase-&gt;{expectedValue}, &quot;prependToEnvironmentVariableList: $testCase-&gt;{description} - return result&quot;);
+    is_deeply($testCase-&gt;{expectedValue}, $ENV{$testCase-&gt;{argName}}, &quot;prependToEnvironmentVariableList: $testCase-&gt;{description} - environment variable value&quot;);
+}
+
</ins></span></pre>
</div>
</div>

</body>
</html>