Source file info
Legend
| → | Has corresponding code |
| → | No direct match, but an alternative exists |
| → | No corresponding code |
| - | TODO |
| ( .. ) | Not localized |
| Example | Python pytest |
PHP PHPUnit |
Swift Testing |
Csharp xunit |
Bash bats |
Powershell pester |
C++ GoogleTest |
JavaScript Jest |
Kotlin jUnit |
|---|---|---|---|---|---|---|---|---|---|
| Get executed command path | sys.argv[0] => ./a.py | $argv[0] | - | - | $0 => ./a.sh | $PSCommandPath | - | - | - |
| Get source file path | __file__ | __FILE__ | - | - | ${BASH_SOURCE[0]} | Get-Command .. ScriptBlock.File | - | - | - |
| Get source directory path | os.path.dirname(__file__) | __DIR__ | - | - | - | $PSScriptRoot | - | - | - |
| ( get_executed_interpreter_path ) | sys.executable | PHP_BINARY | - | - | - | (Get-Process -Id $PID).Path | - | - | - |
| ( get_module_name ) | __name__ | - | - | - | - | - | - | - | - |
| ( get_current_directory ) | os.getcwd() | getcwd() | - | - | - | Get-Location | - | - | - |
| ( get_current_line_number ) | inspect.currentframe().f_lineno | - | - | - | - | - | - | - | - |
| ( get_caller_line_number ) | inspect.currentframe().f_back.f_lineno | - | - | - | - | - | - | - | - |
| ( get_current_function_name ) | inspect.currentframe().f_code.co_name | - | - | - | - | $MyInvocation.MyCommand.Name | - | - | - |
| ( get_caller_function_name ) | inspect.currentframe().f_back.f_code.co_name | - | - | - | - | Get-PSCallStack | - | - | - |
| ( get_current_file_name ) | inspect.currentframe().f_code.co_filename | - | - | - | - | - | - | - | - |
| ( get_caller_file_name ) | inspect.currentframe().f_back.f_code.co_filename | - | - | - | - | - | - | - | - |
| ( execute_when_its_main ) | - | if (realpath($argv[0]) === __FILE__) { | - | - | - | - | - | - | - |
| ( get_executed_command_path_when_called_from_another_script ) | - | - | - | - | - | $PSCommandPath | - | - | - |
| ( get_source_file_path_when_called_from_another_script ) | - | - | - | - | - | Get-Command .. ScriptBlock.File | - | - | - |
| ( get_current_file_path ) | - | - | - | - | - | $PSCommandPath | - | - | - |
| ( get_caller_file_path ) | - | - | - | - | - | Get-PSCallStack | - | - | - |