8145305: fix Nashorn shebang handling on Cygwin

Reviewed-by: hannesw, sundar
This commit is contained in:
Michael Haupt 2016-01-18 11:31:43 +01:00
parent db40a8396b
commit 56fb28f292
2 changed files with 54 additions and 6 deletions

View File

@ -42,6 +42,54 @@ Object.prototype.propertyIsEnumerable=tells whether the given property is enumer
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

View File

@ -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 insn(name) {
}
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 @@ shebs.forEach(function(sheb) {
$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')
})