mirror of
https://github.com/raspberrypi/pico-sdk.git
synced 2026-01-28 01:47:21 +01:00
Add PIOASM test cases for error and valid outputs
Added new test cases to cover invalid character errors, invalid .lang_opt usage, unknown directive errors, and a valid JSON output scenario for pioasm. These tests improve coverage of error handling and output formatting.
This commit is contained in:
parent
9e58e8ac24
commit
60ccf528db
4 changed files with 99 additions and 0 deletions
|
|
@ -0,0 +1,13 @@
|
|||
// run: pioasm input.pio
|
||||
.program invalid_character
|
||||
@
|
||||
nop
|
||||
// -- Output
|
||||
// Command: pioasm input.pio
|
||||
// Exit code: 1
|
||||
// Stdout:
|
||||
// Stderr:
|
||||
// input.pio:3.1: invalid character: @
|
||||
// 3 | @
|
||||
// | ^
|
||||
//
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
// run: pioasm input.pio
|
||||
.program lang_opt_invalid
|
||||
.lang_opt python foo = "unterminated
|
||||
nop
|
||||
// -- Output
|
||||
// Command: pioasm input.pio
|
||||
// Exit code: 1
|
||||
// Stdout:
|
||||
// Stderr:
|
||||
// input.pio:3.24: invalid character: "
|
||||
// 3 | .lang_opt python foo = "unterminated
|
||||
// | ^
|
||||
// input.pio:3.1-22: expected format is .lang_opt language option_name = option_value
|
||||
// 3 | .lang_opt python foo = "unterminated
|
||||
// | ^~~~~~~~~~~~~~~~~~~~~~
|
||||
//
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
// run: pioasm input.pio
|
||||
.program unknown_directive
|
||||
.bogus 1
|
||||
nop
|
||||
// -- Output
|
||||
// Command: pioasm input.pio
|
||||
// Exit code: 1
|
||||
// Stdout:
|
||||
// Stderr:
|
||||
// input.pio:3.1-6: unknown directive .bogus
|
||||
// 3 | .bogus 1
|
||||
// | ^~~~~~
|
||||
//
|
||||
|
|
@ -0,0 +1,57 @@
|
|||
// run: pioasm -o json input.pio
|
||||
.define PUBLIC global_const 7
|
||||
|
||||
.program format_test
|
||||
.origin 4
|
||||
.side_set 2 opt pindirs
|
||||
.define PUBLIC prog_const 3
|
||||
public entry:
|
||||
.wrap_target
|
||||
nop side 1
|
||||
.wrap
|
||||
|
||||
.program second_prog
|
||||
nop
|
||||
// -- Output
|
||||
// Command: pioasm -o json input.pio
|
||||
// Exit code: 0
|
||||
// Stdout:
|
||||
// {
|
||||
// "publicSymbols": {
|
||||
// "global_const": 7
|
||||
// },
|
||||
// "programs": [
|
||||
// {
|
||||
// "name": "format_test",
|
||||
// "wrapTarget": 0,
|
||||
// "wrap": 0,
|
||||
// "origin": 4,
|
||||
// "sideset": {"size": 3, "optional": true, "pindirs": true},
|
||||
// "publicSymbols": {
|
||||
// "prog_const": 3
|
||||
// },
|
||||
// "publicLabels": {
|
||||
// "entry": 0
|
||||
// },
|
||||
// "instructions": [
|
||||
// {"hex": "B442"}
|
||||
// ]
|
||||
// },
|
||||
// {
|
||||
// "name": "second_prog",
|
||||
// "wrapTarget": 0,
|
||||
// "wrap": 0,
|
||||
// "origin": -1,
|
||||
// "sideset": {"size": 0, "optional": false, "pindirs": false},
|
||||
// "publicSymbols": {
|
||||
// },
|
||||
// "publicLabels": {
|
||||
// },
|
||||
// "instructions": [
|
||||
// {"hex": "A042"}
|
||||
// ]
|
||||
// }
|
||||
// ]
|
||||
// }
|
||||
//
|
||||
// Stderr:
|
||||
Loading…
Add table
Reference in a new issue