Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
shopify_iossdk
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
cemarose
shopify_iossdk
Commits
f0a5adf7
Commit
f0a5adf7
authored
Apr 25, 2016
by
Brent Gulanowski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add new tests for NSString additions.
parent
4517b2b0
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
53 additions
and
0 deletions
+53
-0
BUYStringAdditionsTests.m
...le Buy SDK/Mobile Buy SDK Tests/BUYStringAdditionsTests.m
+53
-0
No files found.
Mobile Buy SDK/Mobile Buy SDK Tests/BUYStringAdditionsTests.m
View file @
f0a5adf7
...
@@ -166,4 +166,57 @@ static NSString * const CAMELCaseString = @"CAMELCaseString";
...
@@ -166,4 +166,57 @@ static NSString * const CAMELCaseString = @"CAMELCaseString";
XCTAssertEqualObjects
(
actual
,
expected
,
@"camel case string was incorrect"
);
XCTAssertEqualObjects
(
actual
,
expected
,
@"camel case string was incorrect"
);
}
}
-
(
void
)
testReplacingFileName
{
NSString
*
path
=
@"/path/to/file.txt"
;
NSString
*
expected
=
@"/path/to/other_file.txt"
;
NSString
*
actual
=
[
path
buy_stringByReplacingBaseFileName
:
@"other_file"
];
XCTAssertEqualObjects
(
actual
,
expected
);
}
-
(
void
)
testReplacingDirectory
{
NSString
*
path
=
@"/path/to/file.txt"
;
NSString
*
expected
=
@"/directory_2/file.txt"
;
NSString
*
actual
=
[
path
buy_stringByReplacingDirectory
:
@"/directory_2"
];
XCTAssertEqualObjects
(
actual
,
expected
);
}
-
(
void
)
testStrippingHTML
{
NSString
*
rawHTML
=
@"<!DOCTYPE html>\
<html>\
<body>\
\
<h1>My First Heading</h1>\
\
<p>My first paragraph.</p>\
\
</body>\
</html>"
;
NSString
*
expected
=
@"My First Heading
\n
My first paragraph.
\n
"
;
NSString
*
actual
=
[
rawHTML
buy_stringByStrippingHTML
];
XCTAssertEqualObjects
(
actual
,
expected
);
}
-
(
void
)
testAttributeStringWithLineSpacing
{
NSString
*
string
=
@"Hello, world"
;
NSMutableParagraphStyle
*
style
=
[[
NSMutableParagraphStyle
alloc
]
init
];
style
.
lineSpacing
=
2
.
0
;
style
.
alignment
=
NSTextAlignmentCenter
;
NSAttributedString
*
expected
=
[[
NSAttributedString
alloc
]
initWithString
:
string
attributes
:@{
NSParagraphStyleAttributeName
:
style
}];
NSAttributedString
*
actual
=
[
string
buy_attributedStringWithLineSpacing
:
2
.
0
textAlignment
:
NSTextAlignmentCenter
];
XCTAssertEqualObjects
(
actual
,
expected
);
}
-
(
void
)
testTrim
{
NSString
*
string
=
@"
\t\n
Hello
\t\n
"
;
NSString
*
expected
=
@"Hello"
;
NSString
*
actual
=
[
string
buy_trim
];
XCTAssertEqualObjects
(
actual
,
expected
);
}
@end
@end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment