summaryrefslogtreecommitdiff
path: root/platform/ios/test/MGLSourceTests.m
diff options
context:
space:
mode:
Diffstat (limited to 'platform/ios/test/MGLSourceTests.m')
-rw-r--r--platform/ios/test/MGLSourceTests.m24
1 files changed, 24 insertions, 0 deletions
diff --git a/platform/ios/test/MGLSourceTests.m b/platform/ios/test/MGLSourceTests.m
new file mode 100644
index 0000000000..90ec4e3a0b
--- /dev/null
+++ b/platform/ios/test/MGLSourceTests.m
@@ -0,0 +1,24 @@
+#import "MGLMapViewTests.h"
+
+@interface MGLSourceTests : MGLMapViewTests
+
+@end
+
+@implementation MGLSourceTests
+
+- (void)testDuplicateSources {
+ MGLVectorSource *source1 = [[MGLVectorSource alloc] initWithIdentifier:@"my-source" URL:[NSURL URLWithString:@"mapbox://mapbox.mapbox-terrain-v2"]];
+ MGLVectorSource *source2 = [[MGLVectorSource alloc] initWithIdentifier:@"my-source" URL:[NSURL URLWithString:@"mapbox://mapbox.mapbox-terrain-v2"]];
+
+ [self.mapView.style addSource: source1];
+
+ @try {
+ [self.mapView.style addSource: source2];
+ XCTFail(@"Should not have reached this point");
+ }
+ @catch (NSException *e) {
+ XCTAssertNotNil(e, @"Should have thrown an exception");
+ }
+}
+
+@end