Skip to content
This repository has been archived by the owner on Jul 1, 2024. It is now read-only.

Commit

Permalink
Add tests, some rule fixes (#3)
Browse files Browse the repository at this point in the history
* Add initial tests, some grammar fixes

* Mark generated files as binary
  • Loading branch information
rjmholt authored Jul 8, 2019
1 parent 67b3621 commit 3941c29
Show file tree
Hide file tree
Showing 8 changed files with 23,953 additions and 24,395 deletions.
3 changes: 3 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
*.c binary
src/node-types.json binary
src/grammar.json binary
123 changes: 123 additions & 0 deletions corpus/commands.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
===
Plain cmdlet
===

Write-Something

---

(program
(pipeline_statement
(command_expression
(bareword_string))))

===
Native command
===

net.exe

---

(program
(pipeline_statement
(command_expression
(bareword_string))))

===
Cmdlet with arguments
===

Write-Output 'Hi'

---

(program
(pipeline_statement
(command_expression
(bareword_string)
(command_argument
(single_quote_string)))))

===
Cmdlet with parameters
===

Write-Output -InputObject 'Hi'

---

(program
(pipeline_statement
(command_expression
(bareword_string)
(command_parameter)
(command_argument
(single_quote_string)))))

===
Cmdlet with multiple arguments and parameters
===

Invoke-Thing $argument1 -Parameter 'Thing'

---

(program
(pipeline_statement
(command_expression
(bareword_string)
(command_argument
(variable
(simple_variable)))
(command_parameter)
(command_argument
(single_quote_string)))))

===
Unix-like native command
===

git clone -b this_branch --single-branch https://github.com/PowerShell/PowerShell

---

(program
(pipeline_statement
(command_expression
(bareword_string)
(command_argument
(bareword_string))
(command_parameter)
(command_argument
(bareword_string))
(command_parameter)
(command_argument
(bareword_string)))))

===
Windows-style native command
===

net use e: \\usrsvr002\smithmark Ue345Ii /user:pdc01\msmith2 /savecred /p:yes

---

(program
(pipeline_statement
(command_expression
(bareword_string)
(command_argument
(bareword_string))
(command_argument
(bareword_string))
(command_argument
(bareword_string))
(command_argument
(bareword_string))
(command_argument
(bareword_string))
(command_argument
(bareword_string))
(command_argument
(bareword_string)))))
104 changes: 104 additions & 0 deletions corpus/comments.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
===
Single inline commant
===

$x = 3

# This is a comment

Get-ChildItem .

---

(program
(assignment_statement
(variable
(simple_variable))
(pipeline_statement
(number_expr)))
(comment)
(pipeline_statement
(command_expression
(bareword_string)
(command_argument
(bareword_string)))))

===
Single line block comment
===

$x = 3

<# Block comment #>

Get-ChildItem .

---

(program
(assignment_statement
(variable
(simple_variable))
(pipeline_statement
(number_expr)))
(comment)
(pipeline_statement
(command_expression
(bareword_string)
(command_argument
(bareword_string)))))

===
Multi-line block comment
===

$x = 3

<#

Here

is a

longer

comment #>

Get-ChildItem .

---

(program
(assignment_statement
(variable
(simple_variable))
(pipeline_statement
(number_expr)))
(comment)
(pipeline_statement
(command_expression
(bareword_string)
(command_argument
(bareword_string)))))

===
Pathological block comment #1
===

<##>

---

(program
(comment))

===
Pathological block comment #2
===

<###>

---

(program
(comment))
Loading

0 comments on commit 3941c29

Please sign in to comment.