Rust target: derive Debug for p_position_t
This commit is contained in:
parent
ac7ac9b9a6
commit
5afb3599f9
@ -46,7 +46,7 @@ pub type <%= @grammar.prefix %>code_point_t = u32;
|
|||||||
*
|
*
|
||||||
* This is useful for reporting errors, etc...
|
* This is useful for reporting errors, etc...
|
||||||
*/
|
*/
|
||||||
#[derive(Clone, Copy, Default, PartialEq)]
|
#[derive(Clone, Copy, Debug, Default, PartialEq)]
|
||||||
pub struct <%= @grammar.prefix %>position_t {
|
pub struct <%= @grammar.prefix %>position_t {
|
||||||
/** Input text row (1-based). */
|
/** Input text row (1-based). */
|
||||||
pub row: u32,
|
pub row: u32,
|
||||||
|
|||||||
@ -17,9 +17,7 @@ fn main() {
|
|||||||
/* p_set_position overrides the initial position. */
|
/* p_set_position overrides the initial position. */
|
||||||
let mut c = p_context_new(b"ab");
|
let mut c = p_context_new(b"ab");
|
||||||
p_set_position(&mut c, p_position_t { row: 5, col: 20 });
|
p_set_position(&mut c, p_position_t { row: 5, col: 20 });
|
||||||
let pos = p_position(&c);
|
assert_eq!(p_position_t { row: 5, col: 20 }, p_position(&c));
|
||||||
assert_eq!(5, pos.row);
|
|
||||||
assert_eq!(20, pos.col);
|
|
||||||
assert_eq!(P_SUCCESS, p_lex(&mut c, &mut ti));
|
assert_eq!(P_SUCCESS, p_lex(&mut c, &mut ti));
|
||||||
assert_eq!(TOKEN_a, ti.token);
|
assert_eq!(TOKEN_a, ti.token);
|
||||||
assert_eq!(5, ti.position.row);
|
assert_eq!(5, ti.position.row);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user