PowerShell - hello-world

This commit is contained in:
Xevion
2021-11-26 00:59:55 -06:00
parent 9676e3704d
commit e02f2ceabf
8 changed files with 155 additions and 0 deletions

View File

@@ -0,0 +1,26 @@
{
"blurb": "The classical introductory exercise. Just say \"Hello, World!\"",
"authors": [
"spuder"
],
"contributors": [
"gyssels",
"kchenery",
"kytrinyx",
"marcus-crane",
"masters3d"
],
"files": {
"solution": [
"HelloWorld.ps1"
],
"test": [
"HelloWorld.tests.ps1"
],
"example": [
".meta/HelloWorld.example.ps1"
]
},
"source": "This is an exercise to introduce users to using Exercism",
"source_url": "http://en.wikipedia.org/wiki/%22Hello,_world!%22_program"
}

View File

@@ -0,0 +1 @@
{"track":"powershell","exercise":"hello-world","id":"e2b780a4b32c4a1abe367cb0e62e4c0f","url":"https://exercism.org/tracks/powershell/exercises/hello-world","handle":"Xevion","is_requester":true,"auto_approve":false}

View File

@@ -0,0 +1 @@
1

View File

@@ -0,0 +1,33 @@
# Getting Started
These exercises lean on Test-Driven Development (TDD),
For information installing Powershell click [here](https://docs.microsoft.com/en-us/powershell/scripting/install/installing-powershell?view=powershell-7.1).
Once Powershell is installed you will need to install the Pester module by running the following command in Powershell:
PS> Install-Module Pester
The following steps assume that you are in the same directory as the test suite.
Run the test suite. It's written using the Pester framework, and can be
run with powershell:
PS> Invoke-Pester
This will fail. To fix it, open up the HelloWorld.ps1 file and add the following code:
```
function Get-HelloWorld {
return "Hello World!"
}
```
Run the test again.
## Submit
When everything is passing, you can submit your code with the following
command:
PS> exercism submit HelloWorld.ps1

View File

@@ -0,0 +1,33 @@
# Help
## Running the tests
To run the tests run the command `Invoke-Pester` from within the exercise directory.
## Submitting your solution
You can submit your solution using the `exercism submit HelloWorld.ps1` command.
This command will upload your solution to the Exercism website and print the solution page's URL.
It's possible to submit an incomplete solution which allows you to:
- See how others have completed the exercise
- Request help from a mentor
## Need to get help?
If you'd like help solving the exercise, check the following pages:
- The [PowerShell track's documentation](https://exercism.org/docs/tracks/powershell)
- [Exercism's support channel on gitter](https://gitter.im/exercism/support)
- The [Frequently Asked Questions](https://exercism.org/docs/using/faqs)
Should those resources not suffice, you could submit your (incomplete) solution to request mentoring.
To get help if you are having trouble, you can use one of the following resources:
- [Powershell Documentation][powershell docs]
[Add more resources]: TODO
[powershell docs]: https://docs.microsoft.com/en-us/powershell/

View File

@@ -0,0 +1,14 @@
function Get-HelloWorld {
<#
.SYNOPSIS
Outputs "Hello, World!"
.DESCRIPTION
Output "Hello, World!".
.EXAMPLE
Get-HelloWorld
#>
return "Hello, World!"
}

View File

@@ -0,0 +1,9 @@
BeforeAll {
. ".\HelloWorld.ps1"
}
Describe "HelloWorldTest" {
It "Outputs: 'Hello, World!'" {
Get-HelloWorld | Should -Be 'Hello, World!'
}
}

View File

@@ -0,0 +1,38 @@
# Hello World
Welcome to Hello World on Exercism's PowerShell Track.
If you need help running the tests or submitting your code, check out `HELP.md`.
## Instructions
The classical introductory exercise. Just say "Hello, World!".
["Hello, World!"](http://en.wikipedia.org/wiki/%22Hello,_world!%22_program) is
the traditional first program for beginning programming in a new language
or environment.
The objectives are simple:
- Write a function that returns the string "Hello, World!".
- Run the test suite and make sure that it succeeds.
- Submit your solution and check it at the website.
If everything goes well, you will be ready to fetch your first real exercise.
## Source
### Created by
- @spuder
### Contributed to by
- @gyssels
- @kchenery
- @kytrinyx
- @marcus-crane
- @masters3d
### Based on
This is an exercise to introduce users to using Exercism - http://en.wikipedia.org/wiki/%22Hello,_world!%22_program