changeset 1611:981b353f2f75

8145305: fix Nashorn shebang handling on Cygwin Reviewed-by: hannesw, sundar
author mhaupt
date Mon, 18 Jan 2016 11:31:43 +0100
parents ca4d50be062e
children 086c19a36be6
files src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/resources/Functions.properties test/script/nosecurity/JDK-8144221.js
diffstat 2 files changed, 54 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/resources/Functions.properties	Mon Jan 18 10:25:36 2016 +0100
+++ b/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/resources/Functions.properties	Mon Jan 18 11:31:43 2016 +0100
@@ -42,6 +42,54 @@
 
 Object.bindProperties=binds the source object's properties to the target object (nashorn extension)
 
+Array.isArray=tells whether the argument is an array
+
+Array.prototype.toString=returns a string representation of this array
+
+Array.prototype.assertNumeric=asserts that the array is numeric, throws a type error if this is not the case
+
+Array.prototype.toLocaleString=returns a locale-specific string representation of this array
+
+Array=creates a new array
+
+Array.prototype.concat=concatenates arrays
+
+Array.prototype.join=returns a string representation of the array, with a separator placed between elements
+
+Array.prototype.pop=returns the element from the end of the array, or undefined
+
+Array.prototype.push=appends an element to the end of the array
+
+Array.prototype.reverse=reverses the array
+
+Array.prototype.shift=removes the first element from the array and returns that element
+
+Array.prototype.slice=returns a shallow copy of a slice of the array
+
+Array.prototype.sort=sorts the array
+
+Array.prototype.splice=changes the content of the array by removing and/or adding elements
+
+Array.prototype.unshift=adds one or more elements to the beginning of the array
+
+Array.prototype.indexOf=retrieves the first index of an element in the array, or -1 if the element is not found
+
+Array.prototype.lastIndexOf=retrieves the last index of an element in the array, or -1 if the element is not found
+
+Array.prototype.every=applies a predicate to all elements of the array, returns true if the predicate evaluates to true for all
+
+Array.prototype.some=tests whether a predicate evaluates to true for some element in the array
+
+Array.prototype.forEach=applies a function to all elements in the array
+
+Array.prototype.map=applies a function to all elements in the array, returns the array of results
+
+Array.prototype.filter=returns an array with those elements from this array that match a filter function
+
+Array.prototype.reduce=applies a left-fold to the array and returns the result
+
+Array.prototype.reduceRight=applies a right-fold to the array and returns the result
+
 Function=creates a new function with the given parameters and function body
 
 Function.prototype.toString=returns a string representation of this function
--- a/test/script/nosecurity/JDK-8144221.js	Mon Jan 18 10:25:36 2016 +0100
+++ b/test/script/nosecurity/JDK-8144221.js	Mon Jan 18 11:31:43 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,7 +25,6 @@
  * Test that shebang handling works properly.
  *
  * @test
- * @runif os.not.windows
  * @option -scripting
  * @run
  */
@@ -126,8 +125,9 @@
 }
 
 function run(viajjs, name, arg1, arg2) {
-    var prefix = viajjs ? "${jjs} -scripting " : ''
-    $EXEC("${prefix}./shebang.js ${arg1} ${arg2}")
+    var prefix = viajjs ? "${jjs} -scripting " : win ? 'sh -c "' : '',
+        suffix = viajjs ? '' : win ? '"' : ''
+    $EXEC("${prefix}./shebang.js ${arg1} ${arg2}${suffix}")
     print("* ${name} via ${viajjs ? 'jjs' : 'shebang'}")
     print($OUT.trim())
     print($ERR.trim())
@@ -143,8 +143,8 @@
     $EXEC('chmod +x shebang.js')
     run(false, 'noargs', '', '')
     run(true, 'noargs', '', '')
-    run(false, 'withargs', 'a.js', '"hello world"')
-    run(true, 'withargs', 'a.js', '"hello world"')
+    run(false, 'withargs', 'a.js', "'hello world'")
+    run(true, 'withargs', 'a.js', "'hello world'")
     $EXEC('rm shebang.js')
 })