Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Xcode 5.1 Compatibility Fixes #7

Merged
merged 4 commits into from

2 participants

@wjk
wjk commented

When I tried using your code in my Xcode project, it spat out 100+ warnings. I divided them into three categories:

  • OCUnit is deprecated in favor of XCTest
  • Integer truncation
  • Unused functions

I resolved all three issues. I also updated the gitignore to exclude Xcode 5.1 metadata files that weren’t there in earlier versions of Xcode.

@psychs psychs merged commit 8db5507 into psychs:master
@psychs
Owner

Thanks!

@wjk wjk deleted the wjk:xcode-fixes branch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Apr 5, 2014
  1. @wjk

    Update gitignore

    wjk authored
  2. @wjk

    Update OCUnit to XCTest

    wjk authored
  3. @wjk
  4. @wjk

    Resolve unused-function warnings

    wjk authored
This page is out of date. Refresh to see the latest.
View
3  .gitignore
@@ -19,4 +19,5 @@ mt.dep
debuglog.*
*.intermediate.manifest
xcuserdata/
-
+*.xccheckout
+*.xcsettings
View
27 framework/CocoaOniguruma.xcodeproj/project.pbxproj
@@ -83,7 +83,7 @@
7807AC340E2FBB8600A5AB6A /* regversion.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = regversion.c; sourceTree = "<group>"; };
7807AC350E2FBB8600A5AB6A /* st.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = st.c; sourceTree = "<group>"; };
7807AC360E2FBB8600A5AB6A /* st.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = st.h; sourceTree = "<group>"; };
- 78C5E1B10E39CDCE00F62F5D /* UnitTest.octest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = UnitTest.octest; sourceTree = BUILT_PRODUCTS_DIR; };
+ 78C5E1B10E39CDCE00F62F5D /* UnitTest.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = UnitTest.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
78C5E1B60E39CDEE00F62F5D /* OnigRegexpTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = OnigRegexpTest.h; path = tests/OnigRegexpTest.h; sourceTree = "<group>"; };
78C5E1B70E39CDEE00F62F5D /* OnigRegexpTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = OnigRegexpTest.m; path = tests/OnigRegexpTest.m; sourceTree = "<group>"; };
78C5E1E70E39CEBD00F62F5D /* UnitTest-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "UnitTest-Info.plist"; sourceTree = "<group>"; };
@@ -129,7 +129,7 @@
isa = PBXGroup;
children = (
8DC2EF5B0486A6940098B216 /* CocoaOniguruma.framework */,
- 78C5E1B10E39CDCE00F62F5D /* UnitTest.octest */,
+ 78C5E1B10E39CDCE00F62F5D /* UnitTest.xctest */,
78C5E3A90E39E37F00F62F5D /* TestCommand */,
);
name = Products;
@@ -284,8 +284,8 @@
);
name = UnitTest;
productName = UnitTest;
- productReference = 78C5E1B10E39CDCE00F62F5D /* UnitTest.octest */;
- productType = "com.apple.product-type.bundle";
+ productReference = 78C5E1B10E39CDCE00F62F5D /* UnitTest.xctest */;
+ productType = "com.apple.product-type.bundle.unit-test";
};
78C5E3A80E39E37F00F62F5D /* TestCommand */ = {
isa = PBXNativeTarget;
@@ -329,7 +329,8 @@
0867D690FE84028FC02AAC07 /* Project object */ = {
isa = PBXProject;
attributes = {
- LastUpgradeCheck = 0440;
+ LastTestingUpgradeCheck = 0510;
+ LastUpgradeCheck = 0510;
};
buildConfigurationList = 1DEB91B108733DA50010E9CD /* Build configuration list for PBXProject "CocoaOniguruma" */;
compatibilityVersion = "Xcode 3.2";
@@ -489,9 +490,10 @@
1DEB91B208733DA50010E9CD /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
- ARCHS = "$(ARCHS_STANDARD_32_64_BIT)";
GCC_C_LANGUAGE_STANDARD = c99;
+ GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
+ GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = "";
@@ -501,10 +503,11 @@
1DEB91B308733DA50010E9CD /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
- ARCHS = "$(ARCHS_STANDARD_32_64_BIT)";
DEPLOYMENT_LOCATION = NO;
GCC_C_LANGUAGE_STANDARD = c99;
+ GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
+ GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
INSTALL_PATH = "";
SDKROOT = "";
@@ -517,7 +520,7 @@
ALWAYS_SEARCH_USER_PATHS = NO;
COMBINE_HIDPI_IMAGES = YES;
COPY_PHASE_STRIP = NO;
- FRAMEWORK_SEARCH_PATHS = "$(DEVELOPER_LIBRARY_DIR)/Frameworks";
+ FRAMEWORK_SEARCH_PATHS = "$(inherited)";
GCC_DYNAMIC_NO_PIC = NO;
GCC_ENABLE_OBJC_EXCEPTIONS = YES;
GCC_OPTIMIZATION_LEVEL = 0;
@@ -528,11 +531,8 @@
OTHER_LDFLAGS = (
"-framework",
Cocoa,
- "-framework",
- SenTestingKit,
);
PRODUCT_NAME = UnitTest;
- WRAPPER_EXTENSION = octest;
};
name = Debug;
};
@@ -543,7 +543,7 @@
COMBINE_HIDPI_IMAGES = YES;
COPY_PHASE_STRIP = YES;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
- FRAMEWORK_SEARCH_PATHS = "$(DEVELOPER_LIBRARY_DIR)/Frameworks";
+ FRAMEWORK_SEARCH_PATHS = "$(inherited)";
GCC_ENABLE_OBJC_EXCEPTIONS = YES;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "$(SYSTEM_LIBRARY_DIR)/Frameworks/Cocoa.framework/Headers/Cocoa.h";
@@ -552,11 +552,8 @@
OTHER_LDFLAGS = (
"-framework",
Cocoa,
- "-framework",
- SenTestingKit,
);
PRODUCT_NAME = UnitTest;
- WRAPPER_EXTENSION = octest;
};
name = Release;
};
View
10 framework/core/OnigRegexp.m
@@ -167,7 +167,7 @@ - (OnigResult*)search:(NSString*)target start:(int)start
- (OnigResult*)search:(NSString*)target start:(int)start end:(int)end
{
if (!target) return nil;
- if (end < 0) end = [target length];
+ if (end < 0) end = (int) [target length];
OnigRegion* region = onig_region_new();
const UChar* str = (const UChar*)[target cStringUsingEncoding:STRING_ENCODING];
@@ -195,7 +195,7 @@ - (OnigResult*)search:(NSString*)target start:(int)start end:(int)end
- (OnigResult*)search:(NSString*)target range:(NSRange)range
{
- return [self search:target start:range.location end:NSMaxRange(range)];
+ return [self search:target start:(int) range.location end:(int) NSMaxRange(range)];
}
- (OnigResult*)match:(NSString*)target
@@ -287,7 +287,7 @@ - (NSString*)target
- (int)size
{
- return [self count];
+ return (int) [self count];
}
- (NSUInteger)count
@@ -304,7 +304,7 @@ - (NSArray*)strings
{
NSMutableArray* array = [NSMutableArray array];
int i, count;
- for (i=0, count=[self count]; i<count; i++) {
+ for (i=0, count=(int) [self count]; i<count; i++) {
[array addObject:[self stringAt:i]];
}
return array;
@@ -386,7 +386,7 @@ - (NSIndexSet*)indexesForName:(NSString*)name
- (NSString*)stringForName:(NSString*)name
{
- int n = [self indexForName:name];
+ int n = (int) [self indexForName:name];
return n < 0 ? nil : [self stringAt:n];
}
View
8 framework/core/OnigRegexpUtility.m
@@ -114,8 +114,8 @@ - (NSArray*)split:(id)pattern limit:(NSNumber*)limitNum
OnigResult* res;
while ((res = [pattern search:target start:start])) {
NSRange range = [res bodyRange];
- int end = range.location;
- int right = NSMaxRange(range);
+ int end = (int) range.location;
+ int right = (int) NSMaxRange(range);
if (start == end && range.length == 0) {
if ([target length] == 0) {
@@ -218,11 +218,11 @@ - (NSString*)replaceAllByRegexp:(id)pattern withCallback:(OnigReplaceCallback)ca
do {
NSRange range = [res bodyRange];
- int len = range.location-offset;
+ int len = (int) range.location-offset;
if (len > 0) [s appendString:[self substringWithRange:NSMakeRange(offset, len)]];
[s appendString:callback(res, data, sel)];
- offset = NSMaxRange(range);
+ offset = (int) NSMaxRange(range);
if (range.length == 0) {
// consume 1 character at least
if ([self length] <= offset) break;
View
2  framework/core/oniguruma/enc/utf16_le.c
@@ -106,7 +106,7 @@ utf16le_code_to_mbc(OnigCodePoint code, UChar *buf)
if (code > 0xffff) {
unsigned int plane, high;
- plane = (code >> 16) - 1;
+ plane = (unsigned int) (code >> 16) - 1;
high = (code & 0xff00) >> 8;
*p++ = ((plane & 0x03) << 6) + (high >> 2);
View
28 framework/core/oniguruma/regcomp.c
@@ -52,7 +52,7 @@ static unsigned char PadBuf[WORD_ALIGNMENT_SIZE];
static UChar*
str_dup(UChar* s, UChar* end)
{
- int len = end - s;
+ int len = (int) (end - s);
if (len > 0) {
UChar* r = (UChar* )xmalloc(len + 1);
@@ -73,7 +73,7 @@ swap_node(Node* a, Node* b)
if (NTYPE(a) == NT_STR) {
StrNode* sn = NSTR(a);
if (sn->capa == 0) {
- int len = sn->end - sn->s;
+ int len = (int) (sn->end - sn->s);
sn->s = sn->buf;
sn->end = sn->s + len;
}
@@ -82,7 +82,7 @@ swap_node(Node* a, Node* b)
if (NTYPE(b) == NT_STR) {
StrNode* sn = NSTR(b);
if (sn->capa == 0) {
- int len = sn->end - sn->s;
+ int len = (int) (sn->end - sn->s);
sn->s = sn->buf;
sn->end = sn->s + len;
}
@@ -499,7 +499,7 @@ compile_length_string_raw_node(StrNode* sn, regex_t* reg)
if (sn->end <= sn->s)
return 0;
- return add_compile_string_length(sn->s, 1 /* sb */, sn->end - sn->s, reg, 0);
+ return (int) add_compile_string_length(sn->s, 1 /* sb */, (int) (sn->end - sn->s), reg, 0);
}
static int
@@ -547,7 +547,7 @@ compile_string_raw_node(StrNode* sn, regex_t* reg)
if (sn->end <= sn->s)
return 0;
- return add_compile_string(sn->s, 1 /* sb */, sn->end - sn->s, reg, 0);
+ return (int) add_compile_string(sn->s, 1 /* sb */, (int) (sn->end - sn->s), reg, 0);
}
static int
@@ -2085,7 +2085,7 @@ get_min_match_length(Node* node, OnigDistance *min, ScanEnv* env)
case NT_STR:
{
StrNode* sn = NSTR(node);
- *min = sn->end - sn->s;
+ *min = (OnigDistance) (sn->end - sn->s);
}
break;
@@ -2169,7 +2169,7 @@ get_max_match_length(Node* node, OnigDistance *max, ScanEnv* env)
case NT_STR:
{
StrNode* sn = NSTR(node);
- *max = sn->end - sn->s;
+ *max = (OnigDistance) (sn->end - sn->s);
}
break;
@@ -2542,8 +2542,8 @@ is_not_included(Node* x, Node* y, regex_t* reg)
{
UChar *q;
StrNode* ys = NSTR(y);
- len = NSTRING_LEN(x);
- if (len > NSTRING_LEN(y)) len = NSTRING_LEN(y);
+ len = (int) NSTRING_LEN(x);
+ if (len > (int) NSTRING_LEN(y)) len = (int) NSTRING_LEN(y);
if (NSTRING_IS_AMBIG(x) || NSTRING_IS_AMBIG(y)) {
/* tiny version */
return 0;
@@ -3195,7 +3195,7 @@ update_string_node_case_fold(regex_t* reg, Node *node)
StrNode* sn = NSTR(node);
end = sn->end;
- sbuf_size = (end - sn->s) * 2;
+ sbuf_size = (int) (end - sn->s) * 2;
sbuf = (UChar* )xmalloc(sbuf_size);
CHECK_NULL_RETURN_MEMERR(sbuf);
ebuf = sbuf + sbuf_size;
@@ -3905,7 +3905,7 @@ set_bm_skip(UChar* s, UChar* end, OnigEncoding enc ARG_UNUSED,
{
int i, len;
- len = end - s;
+ len = (int) (end - s);
if (len < ONIG_CHAR_TABLE_SIZE) {
for (i = 0; i < ONIG_CHAR_TABLE_SIZE; i++) skip[i] = len;
@@ -4581,7 +4581,7 @@ optimize_node_left(Node* node, NodeOptInfo* opt, OptEnv* env)
case NT_STR:
{
StrNode* sn = NSTR(node);
- int slen = sn->end - sn->s;
+ int slen = (int) (sn->end - sn->s);
int is_raw = NSTRING_IS_RAW(node);
if (! NSTRING_IS_AMBIG(node)) {
@@ -4920,7 +4920,7 @@ set_optimize_exact_info(regex_t* reg, OptExactInfo* e)
reg->dmax = e->mmd.max;
if (reg->dmin != ONIG_INFINITE_DISTANCE) {
- reg->threshold_len = reg->dmin + (reg->exact_end - reg->exact);
+ reg->threshold_len = (int) (reg->dmin + (reg->exact_end - reg->exact));
}
return 0;
@@ -5281,7 +5281,7 @@ onig_compile(regex_t* reg, const UChar* pattern, const UChar* pattern_end,
#endif
if (reg->alloc == 0) {
- init_size = (pattern_end - pattern) * 2;
+ init_size = (int) (pattern_end - pattern) * 2;
if (init_size <= 0) init_size = COMPILE_INIT_SIZE;
r = BBUF_INIT(reg, init_size);
if (r != 0) goto end;
View
4 framework/core/oniguruma/regenc.c
@@ -728,7 +728,7 @@ onigenc_mb2_code_to_mbc(OnigEncoding enc, OnigCodePoint code, UChar *buf)
if (enclen(enc, buf) != (p - buf))
return ONIGERR_INVALID_CODE_POINT_VALUE;
#endif
- return p - buf;
+ return (int) (p - buf);
}
extern int
@@ -751,7 +751,7 @@ onigenc_mb4_code_to_mbc(OnigEncoding enc, OnigCodePoint code, UChar *buf)
if (enclen(enc, buf) != (p - buf))
return ONIGERR_INVALID_CODE_POINT_VALUE;
#endif
- return p - buf;
+ return (int) (p - buf);
}
extern int
View
6 framework/core/oniguruma/regerror.c
@@ -232,7 +232,7 @@ static int to_ascii(OnigEncoding enc, UChar *s, UChar *end,
*is_over = ((p < end) ? 1 : 0);
}
else {
- len = MIN((end - s), buf_size);
+ len = (int) MIN((end - s), buf_size);
xmemcpy(buf, s, (size_t )len);
*is_over = ((buf_size < (end - s)) ? 1 : 0);
}
@@ -296,7 +296,7 @@ onig_error_code_to_str(s, code, va_alist)
}
}
*p = '\0';
- len = p - s;
+ len = (int) (p - s);
break;
default:
@@ -336,7 +336,7 @@ onig_snprintf_with_pattern(buf, bufsize, enc, pat, pat_end, fmt, va_alist)
n = xvsnprintf((char* )buf, bufsize, (const char* )fmt, args);
va_end(args);
- need = (pat_end - pat) * 4 + 4;
+ need = (int) ((pat_end - pat) * 4 + 4);
if (n + need < bufsize) {
strcat((char* )buf, ": /");
View
44 framework/core/oniguruma/regexec.c
@@ -405,7 +405,7 @@ onig_region_copy(OnigRegion* to, OnigRegion* from)
#define STACK_SAVE do{\
if (stk_base != stk_alloc) {\
msa->stack_p = stk_base;\
- msa->stack_n = stk_end - stk_base;\
+ msa->stack_n = (int) (stk_end - stk_base);\
};\
} while(0)
@@ -435,7 +435,7 @@ stack_double(OnigStackType** arg_stk_base, OnigStackType** arg_stk_end,
stk_end = *arg_stk_end;
stk = *arg_stk;
- n = stk_end - stk_base;
+ n = (int) (stk_end - stk_base);
if (stk_base == stk_alloc && IS_NULL(msa->stack_p)) {
x = (OnigStackType* )xmalloc(sizeof(OnigStackType) * n * 2);
if (IS_NULL(x)) {
@@ -1314,7 +1314,7 @@ match_at(regex_t* reg, const UChar* str, const UChar* end,
sbegin = s;
switch (*p++) {
case OP_END: MOP_IN(OP_END);
- n = s - sstart;
+ n = (int) (s - sstart);
if (n > best_len) {
OnigRegion* region;
#ifdef USE_FIND_LONGEST_SEARCH_ALL_OF_RANGE
@@ -1334,18 +1334,18 @@ match_at(regex_t* reg, const UChar* str, const UChar* end,
if (IS_POSIX_REGION(msa->options)) {
posix_regmatch_t* rmt = (posix_regmatch_t* )region;
- rmt[0].rm_so = sstart - str;
- rmt[0].rm_eo = s - str;
+ rmt[0].rm_so = (regoff_t) (sstart - str);
+ rmt[0].rm_eo = (regoff_t) (s - str);
for (i = 1; i <= num_mem; i++) {
if (mem_end_stk[i] != INVALID_STACK_INDEX) {
if (BIT_STATUS_AT(reg->bt_mem_start, i))
- rmt[i].rm_so = STACK_AT(mem_start_stk[i])->u.mem.pstr - str;
+ rmt[i].rm_so = (int) (STACK_AT(mem_start_stk[i])->u.mem.pstr - str);
else
- rmt[i].rm_so = (UChar* )((void* )(mem_start_stk[i])) - str;
+ rmt[i].rm_so = (int) ((UChar* )((void* )(mem_start_stk[i])) - str);
rmt[i].rm_eo = (BIT_STATUS_AT(reg->bt_mem_end, i)
? STACK_AT(mem_end_stk[i])->u.mem.pstr
- : (UChar* )((void* )mem_end_stk[i])) - str;
+ : ((UChar* )((void* )mem_end_stk[i])) - (regoff_t) str);
}
else {
rmt[i].rm_so = rmt[i].rm_eo = ONIG_REGION_NOTPOS;
@@ -1354,18 +1354,18 @@ match_at(regex_t* reg, const UChar* str, const UChar* end,
}
else {
#endif /* USE_POSIX_API_REGION_OPTION */
- region->beg[0] = sstart - str;
- region->end[0] = s - str;
+ region->beg[0] = (int) (sstart - str);
+ region->end[0] = (int) (s - str);
for (i = 1; i <= num_mem; i++) {
if (mem_end_stk[i] != INVALID_STACK_INDEX) {
if (BIT_STATUS_AT(reg->bt_mem_start, i))
- region->beg[i] = STACK_AT(mem_start_stk[i])->u.mem.pstr - str;
+ region->beg[i] = (int) (STACK_AT(mem_start_stk[i])->u.mem.pstr - str);
else
- region->beg[i] = (UChar* )((void* )mem_start_stk[i]) - str;
+ region->beg[i] = (int) ((UChar* )((void* )mem_start_stk[i]) - str);
region->end[i] = (BIT_STATUS_AT(reg->bt_mem_end, i)
? STACK_AT(mem_end_stk[i])->u.mem.pstr
- : (UChar* )((void* )mem_end_stk[i])) - str;
+ : (UChar* )((void* )mem_end_stk[i])) - (int) str;
}
else {
region->beg[i] = region->end[i] = ONIG_REGION_NOTPOS;
@@ -1387,8 +1387,8 @@ match_at(regex_t* reg, const UChar* str, const UChar* end,
}
node->group = 0;
- node->beg = sstart - str;
- node->end = s - str;
+ node->beg = (int) (sstart - str);
+ node->end = (int) (s - str);
stkp = stk_base;
r = make_capture_history_tree(region->history_root, &stkp,
@@ -2155,7 +2155,7 @@ match_at(regex_t* reg, const UChar* str, const UChar* end,
pend = (BIT_STATUS_AT(reg->bt_mem_end, mem)
? STACK_AT(mem_end_stk[mem])->u.mem.pstr
: (UChar* )((void* )mem_end_stk[mem]));
- n = pend - pstart;
+ n = (int) (pend - pstart);
DATA_ENSURE(n);
sprev = s;
STRING_CMP(pstart, s, n);
@@ -2187,7 +2187,7 @@ match_at(regex_t* reg, const UChar* str, const UChar* end,
pend = (BIT_STATUS_AT(reg->bt_mem_end, mem)
? STACK_AT(mem_end_stk[mem])->u.mem.pstr
: (UChar* )((void* )mem_end_stk[mem]));
- n = pend - pstart;
+ n = (int) (pend - pstart);
DATA_ENSURE(n);
sprev = s;
STRING_CMP_IC(case_fold_flag, pstart, &s, n);
@@ -2219,7 +2219,7 @@ match_at(regex_t* reg, const UChar* str, const UChar* end,
pend = (BIT_STATUS_AT(reg->bt_mem_end, mem)
? STACK_AT(mem_end_stk[mem])->u.mem.pstr
: (UChar* )((void* )mem_end_stk[mem]));
- n = pend - pstart;
+ n = (int) (pend - pstart);
DATA_ENSURE(n);
sprev = s;
swork = s;
@@ -2258,7 +2258,7 @@ match_at(regex_t* reg, const UChar* str, const UChar* end,
pend = (BIT_STATUS_AT(reg->bt_mem_end, mem)
? STACK_AT(mem_end_stk[mem])->u.mem.pstr
: (UChar* )((void* )mem_end_stk[mem]));
- n = pend - pstart;
+ n = (int) (pend - pstart);
DATA_ENSURE(n);
sprev = s;
swork = s;
@@ -2886,7 +2886,7 @@ bm_search_notrev(regex_t* reg, const UChar* target, const UChar* target_end,
#endif
tail = target_end - 1;
- tlen1 = tail - target;
+ tlen1 = (int) (tail - target);
end = text_range;
if (end + tlen1 > text_end)
end = text_end - tlen1;
@@ -2977,7 +2977,7 @@ set_bm_backward_skip(UChar* s, UChar* end, OnigEncoding enc ARG_UNUSED,
if (IS_NULL(*skip)) return ONIGERR_MEMORY;
}
- len = end - s;
+ len = (int) (end - s);
for (i = 0; i < ONIG_CHAR_TABLE_SIZE; i++)
(*skip)[i] = len;
@@ -3745,7 +3745,7 @@ onig_search(regex_t* reg, const UChar* str, const UChar* end,
match:
ONIG_STATE_DEC_THREAD(reg);
MATCH_ARG_FREE(msa);
- return s - str;
+ return (int) (s - str);
}
extern OnigEncoding
View
55 framework/core/oniguruma/regext.c
@@ -30,37 +30,6 @@
#include "regint.h"
static void
-conv_ext0be32(const UChar* s, const UChar* end, UChar* conv)
-{
- while (s < end) {
- *conv++ = '\0';
- *conv++ = '\0';
- *conv++ = '\0';
- *conv++ = *s++;
- }
-}
-
-static void
-conv_ext0le32(const UChar* s, const UChar* end, UChar* conv)
-{
- while (s < end) {
- *conv++ = *s++;
- *conv++ = '\0';
- *conv++ = '\0';
- *conv++ = '\0';
- }
-}
-
-static void
-conv_ext0be(const UChar* s, const UChar* end, UChar* conv)
-{
- while (s < end) {
- *conv++ = '\0';
- *conv++ = *s++;
- }
-}
-
-static void
conv_ext0le(const UChar* s, const UChar* end, UChar* conv)
{
while (s < end) {
@@ -69,33 +38,11 @@ conv_ext0le(const UChar* s, const UChar* end, UChar* conv)
}
}
-static void
-conv_swap4bytes(const UChar* s, const UChar* end, UChar* conv)
-{
- while (s < end) {
- *conv++ = s[3];
- *conv++ = s[2];
- *conv++ = s[1];
- *conv++ = s[0];
- s += 4;
- }
-}
-
-static void
-conv_swap2bytes(const UChar* s, const UChar* end, UChar* conv)
-{
- while (s < end) {
- *conv++ = s[1];
- *conv++ = s[0];
- s += 2;
- }
-}
-
static int
conv_encoding(OnigEncoding from, OnigEncoding to, const UChar* s, const UChar* end,
UChar** conv, UChar** conv_end)
{
- int len = end - s;
+ int len = (int) (end - s);
if (to == ONIG_ENCODING_UTF16_LE) {
if (from == ONIG_ENCODING_ASCII) {
View
4 framework/core/oniguruma/regint.h
@@ -279,7 +279,7 @@ typedef unsigned int BitStatusType;
#define INT_MAX_LIMIT ((1UL << (SIZEOF_INT * 8 - 1)) - 1)
-#define DIGITVAL(code) ((code) - '0')
+#define DIGITVAL(code) ((int) ((code) - '0'))
#define ODIGITVAL(code) DIGITVAL(code)
#define XDIGITVAL(enc,code) \
(ONIGENC_IS_CODE_DIGIT(enc,code) ? DIGITVAL(code) \
@@ -575,7 +575,7 @@ typedef void* PointerType;
#define GET_STATE_CHECK_NUM_INC(num,p) PLATFORM_GET_INC(num, p, StateCheckNumType)
/* code point's address must be aligned address. */
-#define GET_CODE_POINT(code,p) code = *((OnigCodePoint* )(p))
+#define GET_CODE_POINT(code,p) code = (int) *((OnigCodePoint* )(p))
#define GET_BYTE_INC(byte,p) do{\
byte = *(p);\
(p)++;\
View
32 framework/core/oniguruma/regparse.c
@@ -218,7 +218,7 @@ onig_strncmp(const UChar* s1, const UChar* s2, int n)
extern void
onig_strcpy(UChar* dest, const UChar* src, const UChar* end)
{
- int len = end - src;
+ int len = (int) (end - src);
if (len > 0) {
xmemcpy(dest, src, len);
dest[len] = (UChar )0;
@@ -232,7 +232,7 @@ strdup_with_null(OnigEncoding enc, UChar* s, UChar* end)
int slen, term_len, i;
UChar *r;
- slen = end - s;
+ slen = (int) (end - s);
term_len = ONIGENC_MBC_MINLEN(enc);
r = (UChar* )xmalloc(slen + term_len);
@@ -734,7 +734,7 @@ name_add(regex_t* reg, UChar* name, UChar* name_end, int backref, ScanEnv* env)
onig_st_insert_strend(t, e->name, (e->name + (name_end - name)),
(HashDataType )e);
- e->name_len = name_end - name;
+ e->name_len = (int) (name_end - name);
e->back_num = 0;
e->back_alloc = 0;
e->back_refs = (int* )NULL;
@@ -1411,10 +1411,10 @@ node_new_option(OnigOptionType option)
extern int
onig_node_str_cat(Node* node, const UChar* s, const UChar* end)
{
- int addlen = end - s;
+ int addlen = (int) (end - s);
if (addlen > 0) {
- int len = NSTR(node)->end - NSTR(node)->s;
+ int len = (int) (NSTR(node)->end - NSTR(node)->s);
if (NSTR(node)->capa > 0 || (len + addlen > NODE_STR_BUF_SIZE - 1)) {
UChar* p;
@@ -1620,7 +1620,7 @@ scan_unsigned_hexadecimal_number(UChar** src, UChar* end, int maxlen,
if ((INT_MAX_LIMIT - val) / 16UL < num)
return -1; /* overflow */
- num = (num << 4) + XDIGITVAL(enc,c);
+ num = (num << 4) + (int) XDIGITVAL(enc,c);
}
else {
PUNFETCH;
@@ -1710,7 +1710,7 @@ add_code_range_to_buf(BBuf** pbuf, OnigCodePoint from, OnigCodePoint to)
data = (OnigCodePoint* )(bbuf->p);
data++;
- for (low = 0, bound = n; low < bound; ) {
+ for (low = 0, bound = (int) n; low < bound; ) {
x = (low + bound) >> 1;
if (from > data[x*2 + 1])
low = x + 1;
@@ -1718,7 +1718,7 @@ add_code_range_to_buf(BBuf** pbuf, OnigCodePoint from, OnigCodePoint to)
bound = x;
}
- for (high = low, bound = n; high < bound; ) {
+ for (high = low, bound = (int) n; high < bound; ) {
x = (high + bound) >> 1;
if (to >= data[x*2] - 1)
high = x + 1;
@@ -1740,7 +1740,7 @@ add_code_range_to_buf(BBuf** pbuf, OnigCodePoint from, OnigCodePoint to)
if (inc_n != 0 && (OnigCodePoint )high < n) {
int from_pos = SIZE_CODE_POINT * (1 + high * 2);
int to_pos = SIZE_CODE_POINT * (1 + (low + 1) * 2);
- int size = (n - high) * 2 * SIZE_CODE_POINT;
+ int size = (int) ((n - high) * 2 * SIZE_CODE_POINT);
if (inc_n > 0) {
BBUF_MOVE_RIGHT(bbuf, from_pos, to_pos, size);
@@ -1961,7 +1961,7 @@ and_code_range_buf(BBuf* bbuf1, int not1, BBuf* bbuf2, int not2, BBuf** pbuf)
for (i = 0; i < n1; i++) {
from1 = data1[i*2];
to1 = data1[i*2+1];
- r = and_code_range1(pbuf, from1, to1, data2, n2);
+ r = and_code_range1(pbuf, from1, to1, data2, (int) n2);
if (r != 0) return r;
}
}
@@ -2461,13 +2461,13 @@ fetch_escaped_value(UChar** src, UChar* end, ScanEnv* env)
default:
{
backslash:
- c = conv_backslash_value(c, env);
+ c = conv_backslash_value((int) c, env);
}
break;
}
*src = p;
- return c;
+ return (int) c;
}
static int fetch_token(OnigToken* tok, UChar** src, UChar* end, ScanEnv* env);
@@ -2918,7 +2918,7 @@ fetch_token_in_cc(OnigToken* tok, UChar** src, UChar* end, ScanEnv* env)
PFETCH(c);
tok->type = TK_CHAR;
tok->base = 0;
- tok->u.c = c;
+ tok->u.c = (int) c;
tok->escaped = 0;
if (c == ']') {
@@ -2935,7 +2935,7 @@ fetch_token_in_cc(OnigToken* tok, UChar** src, UChar* end, ScanEnv* env)
PFETCH(c);
tok->escaped = 1;
- tok->u.c = c;
+ tok->u.c = (int) c;
switch (c) {
case 'w':
tok->type = TK_CHAR_TYPE;
@@ -3145,7 +3145,7 @@ fetch_token(OnigToken* tok, UChar** src, UChar* end, ScanEnv* env)
tok->backp = p;
PFETCH(c);
- tok->u.c = c;
+ tok->u.c = (int) c;
tok->escaped = 1;
switch (c) {
case '*':
@@ -3581,7 +3581,7 @@ fetch_token(OnigToken* tok, UChar** src, UChar* end, ScanEnv* env)
}
}
else {
- tok->u.c = c;
+ tok->u.c = (int) c;
tok->escaped = 0;
#ifdef USE_VARIABLE_META_CHARS
View
2  framework/core/oniguruma/regparse.h
@@ -96,7 +96,7 @@
#define NSTR_AMBIG (1<<1)
#define NSTR_DONT_GET_OPT_INFO (1<<2)
-#define NSTRING_LEN(node) ((node)->u.str.end - (node)->u.str.s)
+#define NSTRING_LEN(node) ((node)->u.str.end - (int) (node)->u.str.s)
#define NSTRING_SET_RAW(node) (node)->u.str.flag |= NSTR_RAW
#define NSTRING_CLEAR_RAW(node) (node)->u.str.flag &= ~NSTR_RAW
#define NSTRING_SET_AMBIG(node) (node)->u.str.flag |= NSTR_AMBIG
View
4 framework/core/oniguruma/st.c
@@ -118,7 +118,7 @@ new_size(size)
i < (int )(sizeof(primes)/sizeof(primes[0]));
i++, newsize <<= 1)
{
- if (newsize > size) return primes[i];
+ if (newsize > size) return (int) primes[i];
}
/* Ran out of polynomials */
return -1; /* should raise exception */
@@ -574,5 +574,5 @@ static int
numhash(n)
long n;
{
- return n;
+ return (int) n;
}
View
4 framework/tests/OnigRegexpTest.h
@@ -1,8 +1,8 @@
// CocoaOniguruma is copyrighted free software by Satoshi Nakagawa <psychs AT limechat DOT net>.
// You can redistribute it and/or modify it under the new BSD license.
-#import <SenTestingKit/SenTestingKit.h>
+#import <XCTest/XCTest.h>
-@interface OnigRegexpTest : SenTestCase
+@interface OnigRegexpTest : XCTestCase
@end
View
124 framework/tests/OnigRegexpTest.m
@@ -12,11 +12,11 @@ - (void)testSurrogatePairs
OnigRegexp* e = [OnigRegexp compile:@"[^a-z0-9_\\s]"];
OnigResult* r = [e search:[NSString stringWithUTF8String:"012_\xf0\xa3\x8f\x90 abc"]];
- STAssertNotNil(r, nil);
- STAssertEquals([r bodyRange], NSMakeRange(4,2), nil);
- STAssertEqualObjects([r body], [NSString stringWithUTF8String:"\xf0\xa3\x8f\x90"], nil);
- STAssertEqualObjects([r preMatch], @"012_", nil);
- STAssertEqualObjects([r postMatch], @" abc", nil);
+ XCTAssertNotNil(r);
+ XCTAssertEqual([r bodyRange], NSMakeRange(4,2));
+ XCTAssertEqualObjects([r body], [NSString stringWithUTF8String:"\xf0\xa3\x8f\x90"]);
+ XCTAssertEqualObjects([r preMatch], @"012_");
+ XCTAssertEqualObjects([r postMatch], @" abc");
}
- (void)testNamedCaptures
@@ -24,18 +24,18 @@ - (void)testNamedCaptures
OnigRegexp* e = [OnigRegexp compile:@"(?<digits>\\d+)[^\\d]+(?<digits>\\d+)[^a-zA-Z\\d]*(?<letters>[a-zA-Z]+)"];
OnigResult* r = [e search:@" 012/345 \\t abc##"];
- STAssertNotNil(r, nil);
- STAssertEquals(NSMakeRange(2,11), [r bodyRange], nil);
- STAssertEquals([r count], (NSUInteger)4, nil);
- STAssertEquals([r indexForName:@"digits"], (NSInteger)1, nil);
- STAssertEqualObjects([r indexesForName:@"digits"], [NSIndexSet indexSetWithIndexesInRange:NSMakeRange(1,2)], nil);
- STAssertEquals([r indexForName:@"letters"], (NSInteger)3, nil);
- STAssertEqualObjects([r indexesForName:@"letters"], [NSIndexSet indexSetWithIndexesInRange:NSMakeRange(3,1)], nil);
- STAssertEqualObjects([r stringForName:@"digits"], @"012", nil);
+ XCTAssertNotNil(r);
+ XCTAssertEqual(NSMakeRange(2,11), [r bodyRange]);
+ XCTAssertEqual([r count], (NSUInteger)4);
+ XCTAssertEqual([r indexForName:@"digits"], (NSInteger)1);
+ XCTAssertEqualObjects([r indexesForName:@"digits"], [NSIndexSet indexSetWithIndexesInRange:NSMakeRange(1,2)]);
+ XCTAssertEqual([r indexForName:@"letters"], (NSInteger)3);
+ XCTAssertEqualObjects([r indexesForName:@"letters"], [NSIndexSet indexSetWithIndexesInRange:NSMakeRange(3,1)]);
+ XCTAssertEqualObjects([r stringForName:@"digits"], @"012");
NSArray* ary = [r stringsForName:@"digits"];
NSArray* expected = [NSArray arrayWithObjects:@"012", @"345", nil];
- STAssertEqualObjects(ary, expected, nil);
+ XCTAssertEqualObjects(ary, expected);
}
- (void)testSearch
@@ -43,8 +43,8 @@ - (void)testSearch
OnigRegexp* e = [OnigRegexp compile:@"[a-z]+"];
OnigResult* r = [e search:@" 012xyz abc789"];
- STAssertEquals([r bodyRange], NSMakeRange(4,3), nil);
- STAssertEqualObjects([r body], @"xyz", nil);
+ XCTAssertEqual([r bodyRange], NSMakeRange(4,3));
+ XCTAssertEqualObjects([r body], @"xyz");
}
- (void)testMatch
@@ -52,18 +52,18 @@ - (void)testMatch
OnigRegexp* e = [OnigRegexp compile:@"[a-z]+"];
OnigResult* r = [e match:@"abcABC"];
- STAssertEquals(NSMakeRange(0,3), [r bodyRange], nil);
- STAssertEqualObjects(@"abc", [r body], nil);
+ XCTAssertEqual(NSMakeRange(0,3), [r bodyRange]);
+ XCTAssertEqualObjects(@"abc", [r body]);
}
- (void)testRangeOfRegexp
{
- STAssertEquals([@"" rangeOfRegexp:@"^"], NSMakeRange(0,0), nil);
- STAssertEquals([@"" rangeOfRegexp:[OnigRegexp compile:@"^"]], NSMakeRange(0,0), nil);
- STAssertEquals([@" 0 abc xyz" rangeOfRegexp:@"[a-z]+"], NSMakeRange(3,3), nil);
- STAssertEquals([@" 0 abc xyz" rangeOfRegexp:[OnigRegexp compile:@"[a-z]+"]], NSMakeRange(3,3), nil);
- STAssertEquals([@"abc" rangeOfRegexp:@"[^a-z]+"], NSMakeRange(NSNotFound,0), nil);
- STAssertEquals([@"abc" rangeOfRegexp:[OnigRegexp compile:@"[^a-z]+"]], NSMakeRange(NSNotFound,0), nil);
+ XCTAssertEqual([@"" rangeOfRegexp:@"^"], NSMakeRange(0,0));
+ XCTAssertEqual([@"" rangeOfRegexp:[OnigRegexp compile:@"^"]], NSMakeRange(0,0));
+ XCTAssertEqual([@" 0 abc xyz" rangeOfRegexp:@"[a-z]+"], NSMakeRange(3,3));
+ XCTAssertEqual([@" 0 abc xyz" rangeOfRegexp:[OnigRegexp compile:@"[a-z]+"]], NSMakeRange(3,3));
+ XCTAssertEqual([@"abc" rangeOfRegexp:@"[^a-z]+"], NSMakeRange(NSNotFound,0));
+ XCTAssertEqual([@"abc" rangeOfRegexp:[OnigRegexp compile:@"[^a-z]+"]], NSMakeRange(NSNotFound,0));
}
// These tests are based on ruby 1.8's source code.
@@ -73,34 +73,34 @@ - (void)testSplit
NSArray* expected;
expected = [NSArray arrayWithObjects:@"now's", @"the", @"time", nil];
- STAssertEqualObjects([@" now's the time" split], expected, nil);
- STAssertEqualObjects([@" now's the time" splitByRegexp:@" "], expected, nil);
+ XCTAssertEqualObjects([@" now's the time" split], expected);
+ XCTAssertEqualObjects([@" now's the time" splitByRegexp:@" "], expected);
expected = [NSArray arrayWithObjects:@"", @"now's", @"", @"the", @"time", nil];
- STAssertEqualObjects([@" now's the time" splitByRegexp:[OnigRegexp compile:@" "]], expected, nil);
+ XCTAssertEqualObjects([@" now's the time" splitByRegexp:[OnigRegexp compile:@" "]], expected);
expected = [NSArray arrayWithObjects:@"1", @"2.34", @"56", @"7", nil];
- STAssertEqualObjects([@"1, 2.34,56, 7" splitByRegexp:@",\\s*"], expected, nil);
+ XCTAssertEqualObjects([@"1, 2.34,56, 7" splitByRegexp:@",\\s*"], expected);
expected = [NSArray arrayWithObjects:@"h", @"e", @"l", @"l", @"o", nil];
- STAssertEqualObjects([@"hello" splitByRegexp:@""], expected, nil);
+ XCTAssertEqualObjects([@"hello" splitByRegexp:@""], expected);
expected = [NSArray arrayWithObjects:@"h", @"e", @"llo", nil];
- STAssertEqualObjects([@"hello" splitByRegexp:@"" limit:3], expected, nil);
+ XCTAssertEqualObjects([@"hello" splitByRegexp:@"" limit:3], expected);
expected = [NSArray arrayWithObjects:@"h", @"i", @"m", @"o", @"m", nil];
- STAssertEqualObjects([@"hi mom" splitByRegexp:@"\\s*"], expected, nil);
+ XCTAssertEqualObjects([@"hi mom" splitByRegexp:@"\\s*"], expected);
expected = [NSArray arrayWithObjects:@"m", @"w y", @"w", nil];
- STAssertEqualObjects([@"mellow yellow" splitByRegexp:@"ello"], expected, nil);
+ XCTAssertEqualObjects([@"mellow yellow" splitByRegexp:@"ello"], expected);
expected = [NSArray arrayWithObjects:@"1", @"2", @"", @"3", @"4", nil];
- STAssertEqualObjects([@"1,2,,3,4,," splitByRegexp:@","], expected, nil);
+ XCTAssertEqualObjects([@"1,2,,3,4,," splitByRegexp:@","], expected);
expected = [NSArray arrayWithObjects:@"1", @"2", @"", @"3,4,,", nil];
- STAssertEqualObjects([@"1,2,,3,4,," splitByRegexp:@"," limit:4], expected, nil);
+ XCTAssertEqualObjects([@"1,2,,3,4,," splitByRegexp:@"," limit:4], expected);
expected = [NSArray arrayWithObjects:@"1", @"2", @"", @"3", @"4", @"", @"", nil];
- STAssertEqualObjects([@"1,2,,3,4,," splitByRegexp:@"," limit:-4], expected, nil);
+ XCTAssertEqualObjects([@"1,2,,3,4,," splitByRegexp:@"," limit:-4], expected);
}
- (NSString *)succReplace:(OnigResult *)res
@@ -124,69 +124,69 @@ - (NSString *)xReplace:(OnigResult *)res
- (void)testReplace
{
- STAssertEqualObjects([@"" replaceByRegexp:@"" with:@""], @"", nil);
- STAssertEqualObjects([@"" replaceByRegexp:@"" with:@"_"], @"_", nil);
- STAssertEqualObjects([@"" replaceByRegexp:@"0" with:@"_"], @"", nil);
- STAssertEqualObjects([@"abc" replaceByRegexp:@"" with:@"_"], @"_abc", nil);
- STAssertEqualObjects([@"abc" replaceByRegexp:@"$" with:@"_"], @"abc_", nil);
- STAssertEqualObjects([@"aa 00 aa 11" replaceByRegexp:@"\\d+" with:@"digits"], @"aa digits aa 11", nil);
- STAssertEqualObjects([@"hello" replaceByRegexp:@"." withBlock:^(OnigResult* res) {
+ XCTAssertEqualObjects([@"" replaceByRegexp:@"" with:@""], @"");
+ XCTAssertEqualObjects([@"" replaceByRegexp:@"" with:@"_"], @"_");
+ XCTAssertEqualObjects([@"" replaceByRegexp:@"0" with:@"_"], @"");
+ XCTAssertEqualObjects([@"abc" replaceByRegexp:@"" with:@"_"], @"_abc");
+ XCTAssertEqualObjects([@"abc" replaceByRegexp:@"$" with:@"_"], @"abc_");
+ XCTAssertEqualObjects([@"aa 00 aa 11" replaceByRegexp:@"\\d+" with:@"digits"], @"aa digits aa 11");
+ XCTAssertEqualObjects([@"hello" replaceByRegexp:@"." withBlock:^(OnigResult* res) {
unichar ch[2];
ch[0] = [[res body] characterAtIndex:0] + 1;
ch[1] = ' ';
return (NSString *)[NSString stringWithCharacters:ch length:2];
- }], @"i ello", nil);
+ }], @"i ello");
NSString* actual = [@"hello!" replaceByRegexp:@"(.)(.)" withBlock:^(OnigResult* res) {
NSString* body = [res body];
return [NSString stringWithFormat:@"[%@]", body];
}];
- STAssertEqualObjects(actual, @"[he]llo!", nil);
+ XCTAssertEqualObjects(actual, @"[he]llo!");
- STAssertEqualObjects([@"hello" replaceByRegexp:@"l" withBlock:^(OnigResult* res) {
+ XCTAssertEqualObjects([@"hello" replaceByRegexp:@"l" withBlock:^(OnigResult* res) {
return @"x";
- }], @"hexlo", nil);
+ }], @"hexlo");
}
- (void)testReplaceAll
{
- STAssertEqualObjects([@"abc" replaceAllByRegexp:@"" with:@"_"], @"_a_b_c_", nil);
- STAssertEqualObjects([@"abc" replaceAllByRegexp:@"^" with:@"_"], @"_abc", nil);
- STAssertEqualObjects([@"abc" replaceAllByRegexp:@"$" with:@"_"], @"abc_", nil);
- STAssertEqualObjects([@"abc" replaceAllByRegexp:@"." with:@"_"], @"___", nil);
- STAssertEqualObjects([@"aa 00 aa 11" replaceAllByRegexp:@"\\d+" with:@"digits"], @"aa digits aa digits", nil);
+ XCTAssertEqualObjects([@"abc" replaceAllByRegexp:@"" with:@"_"], @"_a_b_c_");
+ XCTAssertEqualObjects([@"abc" replaceAllByRegexp:@"^" with:@"_"], @"_abc");
+ XCTAssertEqualObjects([@"abc" replaceAllByRegexp:@"$" with:@"_"], @"abc_");
+ XCTAssertEqualObjects([@"abc" replaceAllByRegexp:@"." with:@"_"], @"___");
+ XCTAssertEqualObjects([@"aa 00 aa 11" replaceAllByRegexp:@"\\d+" with:@"digits"], @"aa digits aa digits");
- STAssertEqualObjects([@"hello" replaceAllByRegexp:@"." withBlock:^(OnigResult* res) {
+ XCTAssertEqualObjects([@"hello" replaceAllByRegexp:@"." withBlock:^(OnigResult* res) {
unichar ch[2];
ch[0] = [[res body] characterAtIndex:0] + 1;
ch[1] = ' ';
return (NSString *)[NSString stringWithCharacters:ch length:2];
- }], @"i f m m p ", nil);
+ }], @"i f m m p ");
NSString* actual = [@"hello!" replaceAllByRegexp:@"(.)(.)" withBlock:^(OnigResult* res) {
NSString* body = [res body];
return (NSString *)[NSString stringWithFormat:@"[%@]", body];
}];
- STAssertEqualObjects(actual, @"[he][ll][o!]", nil);
+ XCTAssertEqualObjects(actual, @"[he][ll][o!]");
- STAssertEqualObjects([@"hello" replaceAllByRegexp:@"l" withBlock:^(OnigResult* res) {
+ XCTAssertEqualObjects([@"hello" replaceAllByRegexp:@"l" withBlock:^(OnigResult* res) {
return @"x";
- }], @"hexxo", nil);
+ }], @"hexxo");
}
- (void)testError
{
NSError *error = NULL;
id ret = [OnigRegexp compileIgnorecase:nil error:&error];
- STAssertNil(ret, @"Parsed expression");
- STAssertEquals([error code], (NSInteger)ONIG_NORMAL, @"Wrong error code");
- STAssertEqualObjects([error localizedDescription], @"Invalid expression argument", nil);
+ XCTAssertNil(ret, @"Parsed expression");
+ XCTAssertEqual([error code], (NSInteger)ONIG_NORMAL, @"Wrong error code");
+ XCTAssertEqualObjects([error localizedDescription], @"Invalid expression argument");
error = NULL;
ret = [OnigRegexp compileIgnorecase:@"(?<openb>\\[)?year(?(<openb>)\\])" error:&error];
- STAssertNil(ret, @"Parsed expression");
- STAssertEquals([error code], (NSInteger)ONIGERR_UNDEFINED_GROUP_OPTION, @"Wrong error code");
- STAssertEqualObjects([error localizedDescription], @"undefined group option", nil);
+ XCTAssertNil(ret, @"Parsed expression");
+ XCTAssertEqual([error code], (NSInteger)ONIGERR_UNDEFINED_GROUP_OPTION, @"Wrong error code");
+ XCTAssertEqualObjects([error localizedDescription], @"undefined group option");
}
@end
Something went wrong with that request. Please try again.