As there was interest in the failures as well, I will post them.
Background on such scripts. I think these are similar to use case type of scripts (and thus maybe worked into some BDD-style). They focus on what typical types of script functionality is used for system administration oriented tasks. The use cases and operations come from what you can do in a POSIX shell, then carrying these ideas to other scripting platforms, like ruby, python, perl, groovy, vbscript, and powershell. I plan to create some kick-ass website about it (rolls eyes… once I get around to it naturally).
It just so happens, I was asking myself, wouldn't it be awesome if I could run powershell scripts on Unix|Linux|Mac-OS-X? And voilá, I found this project. So I am rather excited. I would be interested to learn how to do unit tests and integration test. I came across a scripting challenge in a job interview for Python, and they used some sort of unit tests, and I had to make sure my implementation passed the unit tests. I thought this was really cool way to program, it was like a race, challenge, to pass the unit tests. I would be a newbie in this category, but then, newbies often make the best testers.
1. Output
* multi-line output using
@" ... "@2. Variables
* formatted output fails
"Number is {0}." -f $num * multi-line strings using
$phrases = @" .. "@3. Arithmetic
* show basic integer arithmetic
* show basic floating math with exponential
* show basic math function like cosine
4. Input
* input a string
* demonstrate using
Read-Host5. Branch
* test a string using
if * NOTE: building string outputs string, when it is not last used in output stream. * test a string using if to determine slice on anonymous list
* test a number range
* test a number for menu selection
* demonstrate string comparison
* multi-way test on a number for menu selection
* demonstrate numerical comparison
* demonstrate string comparison
* multi-way test on single character with pattern matching
* test on single character with pattern matching
*
NOTE:
cmatch not supported.
6. Looping
* collection loops on directory listing and
PsIsContainer to test for a directory
* demonstrate using
switch to process the collection
* count style loop
* demonstrate using while looping construct
* conditional loop
* demonstrate using
do...while() loop construct
* demonstrate using
do...until() loop construct
* demonstrate using
while() loop construct
* spin loop
* demonstrate using
do...while(1) with
break to exit loop
* spin loop with ability to skip invalid input
* demonstrate using
do...while(1) with
continue to skip to next iteration
7. Arrays
* Array Initialization
* initialize array one element at a time
* demonstrate using concatenation operator
+ to append an element to an array
* enumerate all elements
* Array Enumeration
* enumerate array with an index
* demonstrate using general
for to increment the index
8. Associative Arrays
* Associative Array Initialization
* initialize associative array by key
* enumerate all keys
* enumerate all values
* Associative Array Enumeration
* declare and initialize associative array
* merge two associative arrays
* enumerate associative array by key
* demonstrate using collection loop with
foreach9. Subroutines
* demonstrate declaring and calling subroutine
* demonstrate showing formatted date with
Get-Date -UFormat * demonstrate subroutine referencing global variables
* this shows using
$global:variable * demonstrate subroutine explicitly using local variables
* this shows using
$global:variable10. Arguments
* demonstrate processing 2 arguments
* **NOTES:** Retrieving the script name can be done using
$MyInvocation.MyCommand.Name * demonstrate printing all arguments
* use collection loop
foreach * use count style loop with for and a range built using
.. * demonstrate printing arguments in reverse order
* use count style loop with for and a range built using
..11. Parameters
* demonstrate passing a single parameter
* demonstrate controlling degrees of significance with decimal numbers
* demonstrate passing unlimited parameters
12. Exiting
* demonstrate exiting with error code to communicate status
13. Functions
* demonstrate function that returns an int
* demonstrate function that returns a string
* string is capitalized using
ToUpper() method
* demonstrate function that returns an array