Assign variable
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 |
|---|---|---|---|---|---|---|---|---|---|
| Assign reassignable variable | x = 1 | - | var | - | - | - | - | - | - |
| Assign non-reassignable variable | _x = 1 | - | - | - | - | - | - | - | - |
| Assign constant | - | - | let | - | - | - | - | - | - |
| Assign with type | → | - | - | - | - | - | - | - | - |
| Assign without type | x = 1 | - | - | - | - | - | - | - | - |
| Assign to multi variable | (a, b, c) = (1, 2, 3) | - | - | - | - | - | - | - | - |
| Assign to multi variable ( discard partially ) | (a, _, c) = (1, 2, 3) | - | - | - | - | - | - | - | - |
| Assign to multi variable ( when lhs is short ) | ValueError | - | - | - | - | - | - | - | - |
| Assign to multi variable ( when rhs is short ) | ValueError | - | - | - | - | - | - | - | - |
| Null coalescing | x = 'not set' if a is None else a | - | - | - | x="${a:-not set}" | - | - | - | - |
| Null-coalescing-like operation in dictionary | d.get(k, 'not set') | - | - | - | - | - | - | - | - |
| Return value if not empty | - | - | - | - | → | - | - | - | - |
| Block scope | → | - | do { .. } | - | - | - | - | - | - |
| Assignment expression in conditional block ( walrus ) | := ( walrus ) | - | - | - | - | - | - | - | - |