mirror of https://github.com/svaarala/duktape.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
44 lines
798 B
44 lines
798 B
11 years ago
|
/*===
|
||
|
test 1
|
||
|
codepoint: 116
|
||
|
codepoint: 101
|
||
|
codepoint: 115
|
||
|
codepoint: 116
|
||
|
codepoint: 95
|
||
|
codepoint: 115
|
||
|
codepoint: 116
|
||
|
codepoint: 114
|
||
|
codepoint: 105
|
||
|
codepoint: 110
|
||
|
codepoint: 103
|
||
|
test 2
|
||
|
codepoint: 102
|
||
|
codepoint: 111
|
||
|
codepoint: 111
|
||
|
codepoint: 4660
|
||
|
codepoint: 98
|
||
|
codepoint: 97
|
||
|
codepoint: 114
|
||
|
final top: 0
|
||
|
===*/
|
||
|
|
||
11 years ago
|
static void decode_char(void *udata, duk_codepoint_t codepoint) {
|
||
|
printf("codepoint: %ld\n", (long) codepoint);
|
||
11 years ago
|
}
|
||
|
|
||
|
void test(duk_context *ctx) {
|
||
|
printf("test 1\n");
|
||
|
duk_push_string(ctx, "test_string");
|
||
|
duk_decode_string(ctx, -1, decode_char, NULL);
|
||
|
duk_pop(ctx);
|
||
|
|
||
|
printf("test 2\n");
|
||
|
duk_push_string(ctx, "foo" "\xe1\x88\xb4" "bar");
|
||
|
duk_decode_string(ctx, -1, decode_char, NULL);
|
||
|
duk_pop(ctx);
|
||
|
|
||
10 years ago
|
/* XXX: add error cases */
|
||
11 years ago
|
|
||
11 years ago
|
printf("final top: %ld\n", (long) duk_get_top(ctx));
|
||
11 years ago
|
}
|