Skip to content

Commit f8c0cf9

Browse files
author
=
committed
Convert -(NSString *)message, -(NSString *)name, -(GTObject *)target, and -(NSString *)targetType to properties.
1 parent 0727fb4 commit f8c0cf9

File tree

3 files changed

+52
-63
lines changed

3 files changed

+52
-63
lines changed

Classes/GTTag.h

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,13 @@
3838

3939
@property (nonatomic, readonly, strong) GTSignature *tagger;
4040

41-
// The underlying `git_object` as a `git_tag` object.
42-
- (git_tag *)git_tag __attribute__((objc_returns_inner_pointer));
41+
@property (nonatomic,strong) NSString *message;
42+
43+
@property (nonatomic,strong) NSString *name;
4344

44-
- (NSString *)message;
45-
- (NSString *)name;
46-
- (GTObject *)target;
47-
- (NSString *)targetType;
45+
@property (nonatomic,strong) GTObject *target;
46+
47+
@property (nonatomic,strong) NSString *targetType;
4848

4949
// Recursively peel a tag until a non tag GTObject is found
5050
//
@@ -54,4 +54,9 @@
5454
// Returns the found object or nil on error.
5555
- (id)objectByPeelingTagError:(NSError **)error;
5656

57+
// The underlying `git_object` as a `git_tag` object.
58+
- (git_tag *)git_tag __attribute__((objc_returns_inner_pointer));
59+
60+
61+
5762
@end

ObjectiveGitTests/GTTagSpec.m

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
//
2+
// GTOIDSpec.m
3+
// ObjectiveGitFramework
4+
//
5+
// Created by Ezekiel Pierson on 2013-09-06.
6+
// Copyright (c) 2013 GitHub, Inc. All rights reserved.
7+
//
8+
9+
#import "GTTag.h"
10+
11+
SpecBegin(GTTag)
12+
13+
__block GTTag *tag;
14+
15+
beforeEach(^{
16+
NSError *error = nil;
17+
GTRepository *repo = [GTRepository repositoryWithURL:[NSURL fileURLWithPath:TEST_REPO_PATH(self.class)] error:&error];
18+
NSString *tagSHA = @"0c37a5391bbff43c37f0d0371823a5509eed5b1d";
19+
tag = (GTTag *)[repo lookupObjectBySHA:tagSHA error:&error];
20+
expect(error).to.beFalsy;
21+
expect(tag).to.beTruthy;
22+
expect(tagSHA).to.equal(tag.SHA);
23+
});
24+
25+
it(@"can read tag data", ^{
26+
27+
expect(@"tag").to.equal(tag.type);
28+
expect(@"test tag message\n").to.equal(tag.message);
29+
expect(@"v1.0").to.equal(tag.name);
30+
expect(@"5b5b025afb0b4c913b4c338a42934a3863bf3644").to.equal(tag.target.SHA);
31+
expect(@"commit").to.equal(tag.targetType);
32+
33+
GTSignature *signature = tag.tagger;
34+
expect(@"Scott Chacon").to.equal(signature.name);
35+
expect(1288114383).to.equal((int)[signature.time timeIntervalSince1970]);
36+
expect(@"[email protected]").to.equal(signature.email);
37+
38+
39+
});
40+
41+
SpecEnd

ObjectiveGitTests/GTTagTest.m

Lines changed: 0 additions & 57 deletions
This file was deleted.

0 commit comments

Comments
 (0)