Skip to content

Commit 396a283

Browse files
committed
PS: Add tests for flow sources.
1 parent 826e6a9 commit 396a283

File tree

15 files changed

+79
-0
lines changed

15 files changed

+79
-0
lines changed

powershell/ql/test/library-tests/frameworks/microsoft_powershell/test.expected

Whitespace-only changes.
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
$data = Read-Host -Prompt "Enter your name" # $ type="read from stdin"
2+
3+
4+
$xmlQuery = "/Users/User"
5+
$path = "C:/Users/MyData.xml"
6+
$xmldata = Select-Xml -Path $path -XPath $xmlQuery # $ type="file stream"
7+
8+
$hexdata = Format-Hex -Path $path -Count 48 # $ type="file stream"
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
import TestUtilities.InlineFlowSourceTest

powershell/ql/test/library-tests/frameworks/microsoft_win32/test.expected

Whitespace-only changes.
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
$registryPath = "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Windows NT/CurrentVersion"
2+
$valueName = "ProductName"
3+
$productName = [Microsoft.Win32.Registry]::GetValue($registryPath, $valueName, $null) # $ type="a value from the Windows registry"
4+
5+
6+
$registryKey = [Microsoft.Win32.Registry]::LocalMachine.OpenSubKey($registryPath)
7+
8+
# Get the value of a registry key
9+
$productName2 = $registryKey.GetValue($valueName) # $ type="a value from the Windows registry"
10+
11+
12+
# Get all value names in the registry key
13+
$valueNames = $registryKey.GetValueNames() # $ type="a value from the Windows registry"
14+
15+
# TODO: I think this should also have a positional element on the access path
16+
$subKeyNames = $registryKey.GetSubKeyNames() # $ type="a value from the Windows registry"
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
import TestUtilities.InlineFlowSourceTest

powershell/ql/test/library-tests/frameworks/system/test.expected

Whitespace-only changes.
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
$char = [System.Console]::Read() # $ type="read from stdin"
2+
$keyInfo = [System.Console]::ReadKey($true) # $ type="read from stdin"
3+
$userName = [System.Console]::ReadLine() # $ type="read from stdin"
4+
# $input = [System.Console]::ReadToEnd() # TODO we need to model this one
5+
6+
$path = "%USERPROFILE%\Documents"
7+
$expandedPath = [System.Environment]::ExpandEnvironmentVariables($path) # $ type="environment variable"
8+
9+
$args = [System.Environment]::GetCommandLineArgs() # $ type="command line argument"
10+
$variableValue = [System.Environment]::GetEnvironmentVariable("PATH") # $ type="environment variable"
11+
$envVariables = [System.Environment]::GetEnvironmentVariables() # $ type="environment variable"
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
import TestUtilities.InlineFlowSourceTest

powershell/ql/test/library-tests/frameworks/system_io/test.expected

Whitespace-only changes.

0 commit comments

Comments
 (0)