forked from ElementsProject/lightning
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
CCAN: update to get latest rune decode fix.
We didn't handle \ in fields properly, unless they were one-char long. Signed-off-by: Rusty Russell <[email protected]>
- Loading branch information
1 parent
897245e
commit 1f97307
Showing
6 changed files
with
84 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
CCAN imported from http://ccodearchive.net. | ||
|
||
CCAN version: init-2545-g7b11e744 | ||
CCAN version: init-2548-gab87e56b |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
#include <ccan/rune/rune.c> | ||
#include <ccan/rune/coding.c> | ||
#include <ccan/tal/grab_file/grab_file.h> | ||
#include <ccan/tal/str/str.h> | ||
#include <ccan/tap/tap.h> | ||
|
||
int main(void) | ||
{ | ||
static const u8 secret_zero[16]; | ||
struct rune *rune; | ||
struct rune_restr *restr; | ||
const tal_t *ctx = tal(NULL, char); | ||
|
||
plan_tests(9); | ||
restr = rune_restr_from_string(ctx, "desc=@tipjar\\|[email protected]", | ||
strlen("desc=@tipjar\\|[email protected]")); | ||
ok1(tal_count(restr->alterns) == 1); | ||
ok1(restr->alterns[0]->condition == '='); | ||
ok1(streq(restr->alterns[0]->fieldname, "desc")); | ||
ok1(streq(restr->alterns[0]->value, "@tipjar|[email protected]")); | ||
|
||
rune = rune_new(ctx, secret_zero, sizeof(secret_zero), NULL); | ||
rune_add_restr(rune, take(restr)); | ||
|
||
/* Converting via base64 should not change it! */ | ||
rune = rune_from_base64(ctx, rune_to_base64(ctx, rune)); | ||
ok1(tal_count(rune->restrs) == 1); | ||
restr = rune->restrs[0]; | ||
ok1(tal_count(restr->alterns) == 1); | ||
ok1(restr->alterns[0]->condition == '='); | ||
ok1(streq(restr->alterns[0]->fieldname, "desc")); | ||
ok1(streq(restr->alterns[0]->value, "@tipjar|[email protected]")); | ||
|
||
tal_free(ctx); | ||
/* This exits depending on whether all tests passed */ | ||
return exit_status(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters