diff options
author | Nick Mathewson <nickm@torproject.org> | 2017-05-03 12:34:30 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2017-05-04 08:36:50 -0400 |
commit | c8baa9b78362e372cfb5e2d3fcc6100d20d00229 (patch) | |
tree | 40d982ee4e8bc74d4d23028bec762de16abd7e09 /src/test/test_consdiff.c | |
parent | 5acddbbbf74199b46eef75cbbeb11ea6aad9326f (diff) | |
download | tor-c8baa9b78362e372cfb5e2d3fcc6100d20d00229.tar.gz tor-c8baa9b78362e372cfb5e2d3fcc6100d20d00229.zip |
bug#22143/prop#140: Use <n>,$d commands in diffs to remove signatures
In this patch I add support for "delete through end of file" in our
ed diff handler, and generate our diffs so that they remove
everything after in the consensus after the signatures begin.
Diffstat (limited to 'src/test/test_consdiff.c')
-rw-r--r-- | src/test/test_consdiff.c | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/src/test/test_consdiff.c b/src/test/test_consdiff.c index 2e78672a0f..cdc1e6df5b 100644 --- a/src/test/test_consdiff.c +++ b/src/test/test_consdiff.c @@ -931,18 +931,24 @@ test_consdiff_gen_diff(void *arg) consensus_split_lines(cons1, cons1_str, area); diff = consdiff_gen_diff(cons1, cons2, &digests1, &digests2, area); tt_ptr_op(NULL, OP_NE, diff); - tt_int_op(7, OP_EQ, smartlist_len(diff)); + tt_int_op(11, OP_EQ, smartlist_len(diff)); tt_assert(line_str_eq(smartlist_get(diff, 0), "network-status-diff-version 1")); tt_assert(line_str_eq(smartlist_get(diff, 1), "hash " "95D70F5A3CC65F920AA8B44C4563D7781A082674329661884E19E94B79D539C2 " "7AFECEFA4599BA33D603653E3D2368F648DF4AC4723929B0F7CF39281596B0C1")); - tt_assert(line_str_eq(smartlist_get(diff, 2), "3,4d")); - tt_assert(line_str_eq(smartlist_get(diff, 3), "1a")); - tt_assert(line_str_eq(smartlist_get(diff, 4), + tt_assert(line_str_eq(smartlist_get(diff, 2), "6,$d")); + tt_assert(line_str_eq(smartlist_get(diff, 3), "3,4c")); + tt_assert(line_str_eq(smartlist_get(diff, 4), "bar")); + tt_assert(line_str_eq(smartlist_get(diff, 5), + "directory-signature foo bar")); + tt_assert(line_str_eq(smartlist_get(diff, 6), + ".")); + tt_assert(line_str_eq(smartlist_get(diff, 7), "1a")); + tt_assert(line_str_eq(smartlist_get(diff, 8), "r name aaaaaaaaaaaaaaaaa etc")); - tt_assert(line_str_eq(smartlist_get(diff, 5), "foo")); - tt_assert(line_str_eq(smartlist_get(diff, 6), ".")); + tt_assert(line_str_eq(smartlist_get(diff, 9), "foo")); + tt_assert(line_str_eq(smartlist_get(diff, 10), ".")); /* TODO: small real use-cases, i.e. consensuses. */ |