Skip to content
This repository
Browse code

Updated slice()

now allows items to be passed as an array
  • Loading branch information...
commit eb5cf02c53a43a825295c00b9b20a231c4804e3f 1 parent e1c7239
Russ authored
6  Underscore.cfc
@@ -910,7 +910,7 @@ component {
910 910
  	* 	@example _.splice([10, 90, 30], 2, 2);<br /> => [10]<br />_.splice([10, 90, 30], 2, 1, 20);<br /> => [10, 20, 30]
911 911
  	*/ 
912 912
  	public array function splice(array array = this.obj, required numeric index, required numeric howMany) {
913  
- 		var items = _.slice(arguments, 4);
  913
+ 		var items = isArray(arguments[4]) ? arguments[4] : _.slice(arguments, 4);
914 914
 
915 915
  		if (index < 1) {
916 916
  			// negative indices mean position from end of array
@@ -923,9 +923,7 @@ component {
923 923
  		var result = [];
924 924
  		
925 925
  		arrayAppend(result, left, true);
926  
- 		_.each(items, function (item) {
927  
- 			arrayAppend(result, item);
928  
- 		});
  926
+ 		arrayAppend(result, items, true);
929 927
  		arrayAppend(result, right, true);
930 928
 
931 929
  		return result;
2  build.xml
@@ -7,6 +7,6 @@
7 7
    <mxunittask server="localhost" port="8500">
8 8
      <directory path="${user.dir}\mxunit_tests" recurse="true" componentPath="underscore.mxunit_tests" />
9 9
    </mxunittask>
10  
- 
  10
+
11 11
   </target>
12 12
 </project>
145  mxunitdirectorytestsuite_1.xml
... ...
@@ -0,0 +1,145 @@
  1
+
  2
+    
  3
+    
  4
+    
  5
+    
  6
+    
  7
+	
  8
+    
  9
+
  10
+    
  11
+ 
  12
+	
  13
+	
  14
+	
  15
+
  16
+
  17
+	
  18
+	
  19
+
  20
+	
  21
+	
  22
+
  23
+	
  24
+	
  25
+	
  26
+
  27
+
  28
+
  29
+
  30
+
  31
+ 
  32
+
  33
+  
  34
+
  35
+
  36
+  
  37
+
  38
+
  39
+  
  40
+
  41
+
  42
+
  43
+  
  44
+
  45
+
  46
+  
  47
+
  48
+
  49
+  
  50
+
  51
+
  52
+
  53
+
  54
+  
  55
+
  56
+	
  57
+
  58
+
  59
+
  60
+	
  61
+
  62
+
  63
+   
  64
+
  65
+
  66
+    
  67
+
  68
+   
  69
+
  70
+   
  71
+
  72
+   
  73
+
  74
+
  75
+	
  76
+
  77
+	
  78
+
  79
+	
  80
+
  81
+	
  82
+	
  83
+
  84
+	
  85
+	
  86
+
  87
+	
  88
+
  89
+	
  90
+
  91
+	
  92
+
  93
+	
  94
+
  95
+	
  96
+
  97
+	
  98
+
  99
+	
  100
+
  101
+	
  102
+
  103
+	
  104
+
  105
+	
  106
+
  107
+		
  108
+    
  109
+    
  110
+
  111
+	
  112
+	
  113
+	
  114
+
  115
+	
  116
+
  117
+	
  118
+
  119
+	
  120
+
  121
+	
  122
+
  123
+	
  124
+
  125
+	
  126
+
  127
+	
  128
+
  129
+	
  130
+
  131
+	
  132
+
  133
+    
  134
+    
  135
+    
  136
+    
  137
+    
  138
+    
  139
+    
  140
+	    
  141
+	        <testsuite name="mxunit.testresults" hostname="127.0.0.1" tests="6" failures="0" errors="6" timestamp="07/10/12 9:01:19 PM" time="0"><properties><property name="PRODUCTLEVEL" value="os" /><property name="PRODUCTVERSION" value="10,0,0,0" /><property name="SUPPORTEDLOCALES" value="japanese (japan),spanish (peru),english,ja_JP_JP,spanish (panama),serbian (bosnia and herzegovina),macedonian,spanish (guatemala),arabic (united arab emirates),norwegian (norway),albanian (albania),bulgarian,arabic (iraq),arabic (yemen),hungarian,portuguese (portugal),greek (cyprus),arabic (qatar),macedonian (macedonia),swedish,german (switzerland),english (united states),finnish (finland),icelandic,czech,english (malta),slovenian (slovenia),slovak (slovakia),italian,turkish (turkey),chinese,thai,arabic (saudi arabia),norwegian,english (united kingdom),serbian (serbia and montenegro),lithuanian,romanian,english (new zealand),no_NO_NY,lithuanian (lithuania),spanish (nicaragua),dutch,irish (ireland),french (belgium),spanish (spain),arabic (lebanon),korean,french (canada),estonian (estonia),arabic (kuwait),serbian (serbia),spanish (united states),spanish (mexico),arabic (sudan),indonesian (indonesia),russian,latvian,spanish (uruguay),latvian (latvia),hebrew,portuguese (brazil),arabic (syria),croatian,estonian,spanish (dominican republic),french (switzerland),hindi (india),spanish (venezuela),arabic (bahrain),english (philippines),arabic (tunisia),finnish,german (austria),spanish,dutch (netherlands),spanish (ecuador),chinese (taiwan),arabic (jordan),belarusian,icelandic (iceland),spanish (colombia),spanish (costa rica),spanish (chile),arabic (egypt),english (south africa),thai (thailand),greek (greece),italian (italy),catalan,hungarian (hungary),french,english (ireland),ukrainian (ukraine),polish (poland),french (luxembourg),dutch (belgium),english (india),catalan (spain),arabic (morocco),spanish (bolivia),english (australia),serbian,chinese (singapore),portuguese,ukrainian,spanish (el salvador),russian (russia),korean (south korea),vietnamese,arabic (algeria),vietnamese (vietnam),serbian (montenegro),albanian,arabic (libya),arabic,chinese (china),belarusian (belarus),chinese (hong kong),japanese,hebrew (israel),bulgarian (bulgaria),indonesian,maltese (malta),spanish (paraguay),slovenian,french (france),czech (czech republic),italian (switzerland),romanian (romania),spanish (puerto rico),english (canada),german (germany),irish,german (luxembourg),german,spanish (argentina),slovak,malay (malaysia),croatian (croatia),english (singapore),danish,maltese,polish,arabic (oman),turkish,th_TH_TH,greek,malay,swedish (sweden),danish (denmark),spanish (honduras)" /><property name="EXPIRATION" value="{ts &apos;2037-12-31 15:00:00&apos;}" /><property name="ROOTDIR" value="C:\Users\Russ\Desktop\railo-4.0.0.013-railo-express-with-jre-windows64\webroot" /><property name="INSTALLKIT" value="" /><property name="SERIALNUMBER" value="0" /><property name="APPSERVER" value="" /><property name="PRODUCTNAME" value="Railo" /><property name="ARCHMODEL" value="64" /><property name="ADDITIONALINFORMATION" value="" /><property name="ARCH" value="amd64" /><property name="NAME" value="Windows 7" /><property name="BUILDNUMBER" value="" /><property name="VERSION" value="6.1" /><property name="AUTH_PASSWORD" value="" /><property name="AUTH_TYPE" value="" /><property name="AUTH_USER" value="" /><property name="CERT_COOKIE" value="" /><property name="CERT_FLAGS" value="" /><property name="CERT_ISSUER" value="" /><property name="CERT_KEYSIZE" value="" /><property name="CERT_SECRETKEYSIZE" value="" /><property name="CERT_SERIALNUMBER" value="" /><property name="CERT_SERVER_ISSUER" value="" /><property name="CERT_SERVER_SUBJECT" value="" /><property name="CERT_SUBJECT" value="" /><property name="CF_TEMPLATE_PATH" value="C:\Users\Russ\Desktop\railo-4.0.0.013-railo-express-with-jre-windows64\webroot\mxunit\runner\HttpAntRunner.cfc" /><property name="CONTENT_LENGTH" value="" /><property name="CONTENT_TYPE" value="" /><property name="GATEWAY_INTERFACE" value="" /><property name="HTTP_ACCEPT" value="" /><property name="HTTP_ACCEPT_ENCODING" value="" /><property name="HTTP_ACCEPT_LANGUAGE" value="" /><property name="HTTP_CONNECTION" value="" /><property name="HTTP_COOKIE" value="" /><property name="HTTP_HOST" value="localhost:8888" /><property name="HTTP_USER_AGENT" value="Jakarta Commons-HttpClient/3.1" /><property name="HTTP_REFERER" value="" /><property name="HTTPS" value="" /><property name="HTTPS_KEYSIZE" value="" /><property name="HTTPS_SECRETKEYSIZE" value="" /><property name="HTTPS_SERVER_ISSUER" value="" /><property name="HTTPS_SERVER_SUBJECT" value="" /><property name="PATH_INFO" value="" /><property name="PATH_TRANSLATED" value="C:\Users\Russ\Desktop\railo-4.0.0.013-railo-express-with-jre-windows64\webroot\mxunit\runner\HttpAntRunner.cfc" /><property name="QUERY_STRING" value="method=run&amp;type=dir&amp;value=c:%5CUsers%5CRuss%5CDocuments%5CGitHub%5CUnderscoreCF%5Cmxunit_tests&amp;recurse=false&amp;excludes=null&amp;packageName=mxunit.testresults&amp;componentPath=underscore.mxunit_tests" /><property name="REMOTE_ADDR" value="127.0.0.1" /><property name="REMOTE_HOST" value="127.0.0.1" /><property name="REMOTE_USER" value="" /><property name="REQUEST_METHOD" value="GET" /><property name="SCRIPT_NAME" value="/mxunit/runner/HttpAntRunner.cfc" /><property name="SERVER_NAME" value="localhost" /><property name="SERVER_PORT" value="8888" /><property name="SERVER_PORT_SECURE" value="0" /><property name="SERVER_PROTOCOL" value="HTTP/1.1" /><property name="SERVER_SOFTWARE" value="" /><property name="WEB_SERVER_API" value="" /><property name="CONTEXT_PATH" value="" /><property name="LOCAL_ADDR" value="10.0.2.15" /><property name="LOCAL_HOST" value="Russ-laptop" /><property name="MXUNIT_SUMMARY" value="6,6,0,0" /><property name="CFTOKEN" value="0" /><property name="CFID" value="753d43f2-bc21-4113-8eae-b0a71d99d7bd" /><property name="APPLICATIONNAME" value="" /></properties><testcase classname="underscore.mxunit_tests.utilitiesTest" name="utilitiesTest" time="0"><error message="expression"><![CDATA[invalid component definition, can't find underscore.mxunit_tests.utilitiesTest at C:\Users\Russ\Desktop\railo-4.0.0.013-railo-express-with-jre-windows64\webroot\mxunit\framework\TestSuite.cfc:108 at C:\Users\Russ\Desktop\railo-4.0.0.013-railo-express-with-jre-windows64\webroot\mxunit\runner\DirectoryTestSuite.cfc:29 at C:\Users\Russ\Desktop\railo-4.0.0.013-railo-express-with-jre-windows64\webroot\mxunit\runner\HttpAntRunner.cfc:28]]></error></testcase><testcase classname="underscore.mxunit_tests.collectionsTest" name="collectionsTest" time="0"><error message="expression"><![CDATA[invalid component definition, can't find underscore.mxunit_tests.collectionsTest at C:\Users\Russ\Desktop\railo-4.0.0.013-railo-express-with-jre-windows64\webroot\mxunit\framework\TestSuite.cfc:108 at C:\Users\Russ\Desktop\railo-4.0.0.013-railo-express-with-jre-windows64\webroot\mxunit\runner\DirectoryTestSuite.cfc:29 at C:\Users\Russ\Desktop\railo-4.0.0.013-railo-express-with-jre-windows64\webroot\mxunit\runner\HttpAntRunner.cfc:28]]></error></testcase><testcase classname="underscore.mxunit_tests.arraysTest" name="arraysTest" time="0"><error message="expression"><![CDATA[invalid component definition, can't find underscore.mxunit_tests.arraysTest at C:\Users\Russ\Desktop\railo-4.0.0.013-railo-express-with-jre-windows64\webroot\mxunit\framework\TestSuite.cfc:108 at C:\Users\Russ\Desktop\railo-4.0.0.013-railo-express-with-jre-windows64\webroot\mxunit\runner\DirectoryTestSuite.cfc:29 at C:\Users\Russ\Desktop\railo-4.0.0.013-railo-express-with-jre-windows64\webroot\mxunit\runner\HttpAntRunner.cfc:28]]></error></testcase><testcase classname="underscore.mxunit_tests.examplesTest" name="examplesTest" time="0"><error message="expression"><![CDATA[invalid component definition, can't find underscore.mxunit_tests.examplesTest at C:\Users\Russ\Desktop\railo-4.0.0.013-railo-express-with-jre-windows64\webroot\mxunit\framework\TestSuite.cfc:108 at C:\Users\Russ\Desktop\railo-4.0.0.013-railo-express-with-jre-windows64\webroot\mxunit\runner\DirectoryTestSuite.cfc:29 at C:\Users\Russ\Desktop\railo-4.0.0.013-railo-express-with-jre-windows64\webroot\mxunit\runner\HttpAntRunner.cfc:28]]></error></testcase><testcase classname="underscore.mxunit_tests.objectsTest" name="objectsTest" time="0"><error message="expression"><![CDATA[invalid component definition, can't find underscore.mxunit_tests.objectsTest at C:\Users\Russ\Desktop\railo-4.0.0.013-railo-express-with-jre-windows64\webroot\mxunit\framework\TestSuite.cfc:108 at C:\Users\Russ\Desktop\railo-4.0.0.013-railo-express-with-jre-windows64\webroot\mxunit\runner\DirectoryTestSuite.cfc:29 at C:\Users\Russ\Desktop\railo-4.0.0.013-railo-express-with-jre-windows64\webroot\mxunit\runner\HttpAntRunner.cfc:28]]></error></testcase><testcase classname="underscore.mxunit_tests.functionsTest" name="functionsTest" time="0"><error message="expression"><![CDATA[invalid component definition, can't find underscore.mxunit_tests.functionsTest at C:\Users\Russ\Desktop\railo-4.0.0.013-railo-express-with-jre-windows64\webroot\mxunit\framework\TestSuite.cfc:108 at C:\Users\Russ\Desktop\railo-4.0.0.013-railo-express-with-jre-windows64\webroot\mxunit\runner\DirectoryTestSuite.cfc:29 at C:\Users\Russ\Desktop\railo-4.0.0.013-railo-express-with-jre-windows64\webroot\mxunit\runner\HttpAntRunner.cfc:28]]></error></testcase></testsuite>
  142
+	      
  143
+    
  144
+  
  145
+    
8  testresults.properties
... ...
@@ -0,0 +1,8 @@
  1
+#Tue Jul 10 21:01:45 PDT 2012
  2
+success.ratio=.00
  3
+total.failures=0
  4
+failure.ratio=.00
  5
+total.errors=6
  6
+error.ratio=1.00
  7
+total.time=0
  8
+total.runs=6

0 notes on commit eb5cf02

Please sign in to comment.
Something went wrong with that request. Please try again.