Reviewed By: jberdine Differential Revision: D3886011 fbshipit-source-id: 2e0c014master
parent
95f6639d6d
commit
c134eac91e
@ -1,22 +0,0 @@
|
|||||||
java_test(
|
|
||||||
name='objc_tests',
|
|
||||||
deps=[
|
|
||||||
'//infer/tests/frontend:objc_frontend_tests',
|
|
||||||
],
|
|
||||||
)
|
|
||||||
|
|
||||||
java_test(
|
|
||||||
name='objcpp_tests',
|
|
||||||
deps=[
|
|
||||||
'//infer/tests/endtoend:objcpp_endtoend_tests',
|
|
||||||
'//infer/tests/frontend:objcpp_frontend_tests',
|
|
||||||
],
|
|
||||||
)
|
|
||||||
|
|
||||||
java_test(
|
|
||||||
name='clang_tests',
|
|
||||||
deps=[
|
|
||||||
'//infer/tests:objc_tests',
|
|
||||||
'//infer/tests:objcpp_tests',
|
|
||||||
],
|
|
||||||
)
|
|
@ -1,5 +1,12 @@
|
|||||||
/* @generated */
|
/* @generated */
|
||||||
digraph iCFG {
|
digraph iCFG {
|
||||||
|
37 [label="37: Exit frontend_checks_10391c9ce4c9dbd06a97986e9fc1220c \n " color=yellow style=filled]
|
||||||
|
|
||||||
|
|
||||||
|
36 [label="36: Start frontend_checks_10391c9ce4c9dbd06a97986e9fc1220c\nFormals: \nLocals: \n " color=yellow style=filled]
|
||||||
|
|
||||||
|
|
||||||
|
36 -> 37 ;
|
||||||
35 [label="35: DeclStmt \n n$4=_fun___objc_alloc_no_fail(sizeof(class NSAutoreleasePool ):unsigned long ) [line 60]\n n$5=_fun_NSObject_init(n$4:class NSAutoreleasePool *) virtual [line 60]\n *&pool:class NSAutoreleasePool *=n$5 [line 60]\n " shape="box"]
|
35 [label="35: DeclStmt \n n$4=_fun___objc_alloc_no_fail(sizeof(class NSAutoreleasePool ):unsigned long ) [line 60]\n n$5=_fun_NSObject_init(n$4:class NSAutoreleasePool *) virtual [line 60]\n *&pool:class NSAutoreleasePool *=n$5 [line 60]\n " shape="box"]
|
||||||
|
|
||||||
|
|
@ -1,131 +0,0 @@
|
|||||||
digraph iCFG {
|
|
||||||
721 [label="721: BinaryOperatorStmt: Assign \n n$648=*&self:class NullDeref * [line 8]\n n$649=*&attachmentContainerView:class UIView * [line 8]\n *n$648.NullDeref__attachmentContainerView:class NullDeref *=n$649 [line 8]\n REMOVE_TEMPS(n$648,n$649); [line 8]\n NULLIFY(&attachmentContainerView,false); [line 8]\n NULLIFY(&self,false); [line 8]\n APPLY_ABSTRACTION; [line 8]\n " shape="box"]
|
|
||||||
|
|
||||||
|
|
||||||
721 -> 720 ;
|
|
||||||
720 [label="720: Exit NullDeref_setAttachmentContainerView: \n " color=yellow style=filled]
|
|
||||||
|
|
||||||
|
|
||||||
719 [label="719: Start NullDeref_setAttachmentContainerView:\nFormals: self:class NullDeref * attachmentContainerView:class UIView *\nLocals: \n DECLARE_LOCALS(&return); [line 8]\n " color=yellow style=filled]
|
|
||||||
|
|
||||||
|
|
||||||
719 -> 721 ;
|
|
||||||
718 [label="718: Return Stmt \n n$646=*&self:class NullDeref * [line 8]\n n$647=*n$646.NullDeref__attachmentContainerView:class UIView * [line 8]\n *&return:class UIView *=n$647 [line 8]\n REMOVE_TEMPS(n$646,n$647); [line 8]\n NULLIFY(&self,false); [line 8]\n APPLY_ABSTRACTION; [line 8]\n " shape="box"]
|
|
||||||
|
|
||||||
|
|
||||||
718 -> 717 ;
|
|
||||||
717 [label="717: Exit NullDeref_attachmentContainerView \n " color=yellow style=filled]
|
|
||||||
|
|
||||||
|
|
||||||
716 [label="716: Start NullDeref_attachmentContainerView\nFormals: self:class NullDeref *\nLocals: \n DECLARE_LOCALS(&return); [line 8]\n " color=yellow style=filled]
|
|
||||||
|
|
||||||
|
|
||||||
716 -> 718 ;
|
|
||||||
715 [label="715: BinaryOperatorStmt: Assign \n n$644=*&self:class NullDeref * [line 7]\n n$645=*&backgroundCoveringView:class UIView * [line 7]\n *n$644.NullDeref__backgroundCoveringView:class NullDeref *=n$645 [line 7]\n REMOVE_TEMPS(n$644,n$645); [line 7]\n NULLIFY(&backgroundCoveringView,false); [line 7]\n NULLIFY(&self,false); [line 7]\n APPLY_ABSTRACTION; [line 7]\n " shape="box"]
|
|
||||||
|
|
||||||
|
|
||||||
715 -> 714 ;
|
|
||||||
714 [label="714: Exit NullDeref_setBackgroundCoveringView: \n " color=yellow style=filled]
|
|
||||||
|
|
||||||
|
|
||||||
713 [label="713: Start NullDeref_setBackgroundCoveringView:\nFormals: self:class NullDeref * backgroundCoveringView:class UIView *\nLocals: \n DECLARE_LOCALS(&return); [line 7]\n " color=yellow style=filled]
|
|
||||||
|
|
||||||
|
|
||||||
713 -> 715 ;
|
|
||||||
712 [label="712: Return Stmt \n n$642=*&self:class NullDeref * [line 7]\n n$643=*n$642.NullDeref__backgroundCoveringView:class UIView * [line 7]\n *&return:class UIView *=n$643 [line 7]\n REMOVE_TEMPS(n$642,n$643); [line 7]\n NULLIFY(&self,false); [line 7]\n APPLY_ABSTRACTION; [line 7]\n " shape="box"]
|
|
||||||
|
|
||||||
|
|
||||||
712 -> 711 ;
|
|
||||||
711 [label="711: Exit NullDeref_backgroundCoveringView \n " color=yellow style=filled]
|
|
||||||
|
|
||||||
|
|
||||||
710 [label="710: Start NullDeref_backgroundCoveringView\nFormals: self:class NullDeref *\nLocals: \n DECLARE_LOCALS(&return); [line 7]\n " color=yellow style=filled]
|
|
||||||
|
|
||||||
|
|
||||||
710 -> 712 ;
|
|
||||||
709 [label="709: DeclStmt \n n$641=_fun___objc_alloc(sizeof(struct __SecKey ):struct __SecKey *) [line 39]\n *&allowedPublicKey:struct __SecKey *=n$641 [line 39]\n REMOVE_TEMPS(n$641); [line 39]\n " shape="box"]
|
|
||||||
|
|
||||||
|
|
||||||
709 -> 708 ;
|
|
||||||
708 [label="708: Call _fun___objc_release \n n$638=*&allowedPublicKey:struct __SecKey * [line 40]\n n$639=_fun___objc_release(1:_Bool ,n$638:void *) [line 40]\n REMOVE_TEMPS(n$638,n$639); [line 40]\n NULLIFY(&allowedPublicKey,false); [line 40]\n APPLY_ABSTRACTION; [line 40]\n " shape="box"]
|
|
||||||
|
|
||||||
|
|
||||||
708 -> 707 ;
|
|
||||||
707 [label="707: Exit NullDeref_test2 \n " color=yellow style=filled]
|
|
||||||
|
|
||||||
|
|
||||||
706 [label="706: Start NullDeref_test2\nFormals: \nLocals: allowedPublicKey:struct __SecKey * \n DECLARE_LOCALS(&return,&allowedPublicKey); [line 37]\n NULLIFY(&allowedPublicKey,false); [line 37]\n " color=yellow style=filled]
|
|
||||||
|
|
||||||
|
|
||||||
706 -> 709 ;
|
|
||||||
705 [label="705: DeclStmt \n n$636=*&rect:struct CGRect [line 29]\n n$637=_fun_CGRectGetHeight(n$636:struct CGRect ) [line 29]\n *&lineThickness:double =(0.200000 * n$637) [line 29]\n REMOVE_TEMPS(n$636,n$637); [line 29]\n NULLIFY(&rect,false); [line 29]\n NULLIFY(&lineThickness,false); [line 29]\n " shape="box"]
|
|
||||||
|
|
||||||
|
|
||||||
705 -> 704 ;
|
|
||||||
704 [label="704: DeclStmt \n n$635=_fun_CGPathCreateMutable() [line 32]\n *&path1:struct CGPath *=n$635 [line 32]\n REMOVE_TEMPS(n$635); [line 32]\n " shape="box"]
|
|
||||||
|
|
||||||
|
|
||||||
704 -> 703 ;
|
|
||||||
703 [label="703: Call _fun___objc_release \n n$633=*&path1:struct CGPath * [line 33]\n n$634=_fun___objc_release(1:_Bool ,n$633:void *) [line 33]\n REMOVE_TEMPS(n$633,n$634); [line 33]\n NULLIFY(&path1,false); [line 33]\n APPLY_ABSTRACTION; [line 33]\n " shape="box"]
|
|
||||||
|
|
||||||
|
|
||||||
703 -> 702 ;
|
|
||||||
702 [label="702: Exit NullDeref_createCloseCrossGlyphNoLeak: \n " color=yellow style=filled]
|
|
||||||
|
|
||||||
|
|
||||||
701 [label="701: Start NullDeref_createCloseCrossGlyphNoLeak:\nFormals: rect:struct CGRect \nLocals: lineThickness:double path1:struct CGPath * \n DECLARE_LOCALS(&return,&lineThickness,&path1); [line 27]\n NULLIFY(&lineThickness,false); [line 27]\n NULLIFY(&path1,false); [line 27]\n " color=yellow style=filled]
|
|
||||||
|
|
||||||
|
|
||||||
701 -> 705 ;
|
|
||||||
700 [label="700: DeclStmt \n n$632=_fun___objc_alloc(sizeof(struct __CFAttributedString ):struct __CFAttributedString *) [line 22]\n *&maString:struct __CFAttributedString *=n$632 [line 22]\n REMOVE_TEMPS(n$632); [line 22]\n " shape="box"]
|
|
||||||
|
|
||||||
|
|
||||||
700 -> 698 ;
|
|
||||||
700 -> 699 ;
|
|
||||||
699 [label="699: Prune (false branch) \n n$628=*&maString:struct __CFAttributedString * [line 21]\n PRUNE(!n$628, false); [line 23]\n REMOVE_TEMPS(n$628); [line 23]\n APPLY_ABSTRACTION; [line 23]\n " shape="invhouse"]
|
|
||||||
|
|
||||||
|
|
||||||
699 -> 696 ;
|
|
||||||
698 [label="698: Prune (true branch) \n n$628=*&maString:struct __CFAttributedString * [line 21]\n PRUNE(n$628, true); [line 23]\n REMOVE_TEMPS(n$628); [line 23]\n " shape="invhouse"]
|
|
||||||
|
|
||||||
|
|
||||||
698 -> 697 ;
|
|
||||||
697 [label="697: Call _fun___objc_release \n n$629=*&maString:struct __CFAttributedString * [line 23]\n n$630=_fun___objc_release(1:_Bool ,n$629:void *) [line 23]\n REMOVE_TEMPS(n$629,n$630); [line 23]\n NULLIFY(&maString,false); [line 23]\n APPLY_ABSTRACTION; [line 23]\n " shape="box"]
|
|
||||||
|
|
||||||
|
|
||||||
697 -> 696 ;
|
|
||||||
696 [label="696: + \n NULLIFY(&maString,false); [line 23]\n " ]
|
|
||||||
|
|
||||||
|
|
||||||
696 -> 695 ;
|
|
||||||
695 [label="695: Exit NullDeref_measureFrameSizeForTextNoLeak \n " color=yellow style=filled]
|
|
||||||
|
|
||||||
|
|
||||||
694 [label="694: Start NullDeref_measureFrameSizeForTextNoLeak\nFormals: \nLocals: maString:struct __CFAttributedString * \n DECLARE_LOCALS(&return,&maString); [line 20]\n NULLIFY(&maString,false); [line 20]\n " color=yellow style=filled]
|
|
||||||
|
|
||||||
|
|
||||||
694 -> 700 ;
|
|
||||||
693 [label="693: DeclStmt \n n$627=_fun___objc_alloc(sizeof(class UIView ):class UIView *) [line 12]\n *&attachmentContainerView:class UIView *=n$627 [line 12]\n REMOVE_TEMPS(n$627); [line 12]\n " shape="box"]
|
|
||||||
|
|
||||||
|
|
||||||
693 -> 692 ;
|
|
||||||
692 [label="692: DeclStmt \n n$624=*&attachmentContainerView:class UIView * [line 13]\n n$623=_fun_UIView_bounds(n$624:class UIView *) virtual [line 13]\n n$625=_fun_CGPathCreateWithRect(n$623:struct CGRect ,0:CGAffineTransform *) [line 13]\n *&shadowPath:struct CGPath *=n$625 [line 13]\n REMOVE_TEMPS(n$623,n$624,n$625); [line 13]\n " shape="box"]
|
|
||||||
|
|
||||||
|
|
||||||
692 -> 691 ;
|
|
||||||
691 [label="691: Call _fun___objc_release \n n$621=*&shadowPath:struct CGPath * [line 14]\n n$622=_fun___objc_release(1:_Bool ,n$621:void *) [line 14]\n REMOVE_TEMPS(n$621,n$622); [line 14]\n NULLIFY(&shadowPath,false); [line 14]\n " shape="box"]
|
|
||||||
|
|
||||||
|
|
||||||
691 -> 690 ;
|
|
||||||
690 [label="690: Message Call: release \n n$620=*&attachmentContainerView:class UIView * [line 15]\n n$619=_fun_NSObject_release(n$620:class UIView *) [line 15]\n REMOVE_TEMPS(n$619,n$620); [line 15]\n NULLIFY(&attachmentContainerView,false); [line 15]\n APPLY_ABSTRACTION; [line 15]\n " shape="box"]
|
|
||||||
|
|
||||||
|
|
||||||
690 -> 689 ;
|
|
||||||
689 [label="689: Exit NullDeref_layoutSubviews \n " color=yellow style=filled]
|
|
||||||
|
|
||||||
|
|
||||||
688 [label="688: Start NullDeref_layoutSubviews\nFormals: self:class NullDeref *\nLocals: attachmentContainerView:class UIView * shadowPath:struct CGPath * \n DECLARE_LOCALS(&return,&attachmentContainerView,&shadowPath); [line 10]\n NULLIFY(&attachmentContainerView,false); [line 10]\n NULLIFY(&self,false); [line 10]\n NULLIFY(&shadowPath,false); [line 10]\n " color=yellow style=filled]
|
|
||||||
|
|
||||||
|
|
||||||
688 -> 693 ;
|
|
||||||
}
|
|
@ -0,0 +1,90 @@
|
|||||||
|
# Copyright (c) 2016 - present Facebook, Inc.
|
||||||
|
# All rights reserved.
|
||||||
|
#
|
||||||
|
# This source code is licensed under the BSD style license found in the
|
||||||
|
# LICENSE file in the root directory of this source tree. An additional grant
|
||||||
|
# of patent rights can be found in the PATENTS file in the same directory.
|
||||||
|
|
||||||
|
include ../../Makefile.frontend
|
||||||
|
|
||||||
|
IPHONESIMULATOR_ISYSROOT_SUFFIX = /Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk
|
||||||
|
|
||||||
|
XCODEROOT = $(shell xcode-select -p)
|
||||||
|
|
||||||
|
OPTIONS = -x objective-c \
|
||||||
|
-isysroot $(XCODEROOT)$(IPHONESIMULATOR_ISYSROOT_SUFFIX) \
|
||||||
|
-mios-simulator-version-min=8.2 --target=x86_64-apple-darwin14 -c \
|
||||||
|
|
||||||
|
FILES_NOARC = \
|
||||||
|
block/BlockVar.m \
|
||||||
|
block/block-it.m \
|
||||||
|
block/block.m \
|
||||||
|
block/block_no_args.m \
|
||||||
|
block/block_release.m \
|
||||||
|
block/dispatch.m \
|
||||||
|
block/dispatch_examples.m \
|
||||||
|
block/retain_cycle.m \
|
||||||
|
block/static.m \
|
||||||
|
boxing/Boxing.m \
|
||||||
|
boxing/array.m \
|
||||||
|
boxing/array_literal.c \
|
||||||
|
boxing/dict_literal.c \
|
||||||
|
boxing/string_literal.c \
|
||||||
|
conditional_operation/ConditionalOperation.m \
|
||||||
|
exceptions/ExceptionExample.m \
|
||||||
|
fast_enumeration/Fast_enumeration.m \
|
||||||
|
property/PropertyAttributes.m \
|
||||||
|
property/PropertyCustomAccessor.m \
|
||||||
|
property/PropertyImplSetter.m \
|
||||||
|
property/Property_getter.m \
|
||||||
|
property/aclass.m \
|
||||||
|
property/main_car.m \
|
||||||
|
property_in_protocol/Test.m \
|
||||||
|
protocol/protocol.m \
|
||||||
|
returnstmt/void_return.m \
|
||||||
|
self_static/Self.m \
|
||||||
|
self_static/static.m \
|
||||||
|
strings/global_string_literal.m \
|
||||||
|
strings/string_literal.m \
|
||||||
|
subclass/MyClass.m \
|
||||||
|
subclass/MySubClass.m \
|
||||||
|
subclass/main.c \
|
||||||
|
types/testloop.m \
|
||||||
|
vardecl/aclass.m \
|
||||||
|
vardecl/aclass_2.m \
|
||||||
|
vardecl/last_af.m \
|
||||||
|
link_to_errors/category_procdesc/EOCPerson.m \
|
||||||
|
link_to_errors/category_procdesc/main.c \
|
||||||
|
link_to_errors/field_superclass/SuperExample.m \
|
||||||
|
link_to_errors/memory_leaks_benchmark/AutoreleaseExample.m \
|
||||||
|
link_to_errors/memory_leaks_benchmark/MemoryLeakExample.m \
|
||||||
|
link_to_errors/memory_leaks_benchmark/RetainReleaseExample.m \
|
||||||
|
link_to_errors/memory_leaks_benchmark/RetainReleaseExample2.m \
|
||||||
|
link_to_errors/memory_leaks_benchmark/TollBridgeExample.m \
|
||||||
|
link_to_errors/npe/npe_malloc.m \
|
||||||
|
link_to_errors/protocol_procdesc/main.c \
|
||||||
|
|
||||||
|
FILES_ARC = \
|
||||||
|
assertions/NSAssert_example.m \
|
||||||
|
predefined_expr/PredefinedExprExample.m \
|
||||||
|
types/attributes.m \
|
||||||
|
types/void_call.m \
|
||||||
|
vardecl/initlist.m \
|
||||||
|
link_to_errors/npe/Nonnull_attribute_example.m \
|
||||||
|
link_to_errors/memory_leaks_benchmark/ArcExample.m \
|
||||||
|
link_to_errors/memory_leaks_benchmark/arc_methods.m \
|
||||||
|
|
||||||
|
FILES = \
|
||||||
|
$(FILES_NOARC) \
|
||||||
|
$(FILES_ARC) \
|
||||||
|
|
||||||
|
compile:
|
||||||
|
clang $(OPTIONS) $(FILES_NOARC)
|
||||||
|
clang $(OPTIONS) -fobjc-arc $(FILES_ARC)
|
||||||
|
|
||||||
|
capture:
|
||||||
|
infer -a capture --cxx --frontend-tests --continue --reactive -- clang $(OPTIONS) $(FILES_NOARC)
|
||||||
|
infer -a capture --cxx --frontend-tests -- clang $(OPTIONS) -fobjc-arc $(FILES_ARC)
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -0,0 +1 @@
|
|||||||
|
../errors/
|
@ -1,9 +1,9 @@
|
|||||||
/* @generated */
|
/* @generated */
|
||||||
digraph iCFG {
|
digraph iCFG {
|
||||||
21 [label="21: Exit frontend_checks_23a4fcc8f25cc8087aa9202ac0edfbf5 \n " color=yellow style=filled]
|
21 [label="21: Exit frontend_checks_b9a66dfb333031907793a9bdd13fca5f \n " color=yellow style=filled]
|
||||||
|
|
||||||
|
|
||||||
20 [label="20: Start frontend_checks_23a4fcc8f25cc8087aa9202ac0edfbf5\nFormals: \nLocals: \n " color=yellow style=filled]
|
20 [label="20: Start frontend_checks_b9a66dfb333031907793a9bdd13fca5f\nFormals: \nLocals: \n " color=yellow style=filled]
|
||||||
|
|
||||||
|
|
||||||
20 -> 21 ;
|
20 -> 21 ;
|
@ -0,0 +1,29 @@
|
|||||||
|
# Copyright (c) 2016 - present Facebook, Inc.
|
||||||
|
# All rights reserved.
|
||||||
|
#
|
||||||
|
# This source code is licensed under the BSD style license found in the
|
||||||
|
# LICENSE file in the root directory of this source tree. An additional grant
|
||||||
|
# of patent rights can be found in the PATENTS file in the same directory.
|
||||||
|
|
||||||
|
include ../../Makefile.frontend
|
||||||
|
|
||||||
|
IPHONESIMULATOR_ISYSROOT_SUFFIX = /Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk
|
||||||
|
|
||||||
|
XCODEROOT = $(shell xcode-select -p)
|
||||||
|
|
||||||
|
OPTIONS = -x objective-c++ -std=c++11 \
|
||||||
|
-isysroot $(XCODEROOT)$(IPHONESIMULATOR_ISYSROOT_SUFFIX) \
|
||||||
|
-mios-simulator-version-min=8.2 --target=x86_64-apple-darwin14 -c \
|
||||||
|
|
||||||
|
FILES = \
|
||||||
|
funcoverloading/af_test.mm \
|
||||||
|
global_const/global_const.mm \
|
||||||
|
|
||||||
|
compile:
|
||||||
|
clang $(OPTIONS) $(FILES)
|
||||||
|
|
||||||
|
capture:
|
||||||
|
infer -a capture --cxx --frontend-tests --continue --reactive -- clang $(OPTIONS) $(FILES)
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1,63 +0,0 @@
|
|||||||
tests_dependencies = [
|
|
||||||
'//infer/lib/java/android:android',
|
|
||||||
'//dependencies/java/guava:guava',
|
|
||||||
'//dependencies/java/junit:hamcrest',
|
|
||||||
'//dependencies/java/jackson:jackson',
|
|
||||||
'//dependencies/java/jsr-305:jsr-305',
|
|
||||||
'//dependencies/java/junit:junit',
|
|
||||||
'//dependencies/java/opencsv:opencsv',
|
|
||||||
'//infer/tests/utils:utils'
|
|
||||||
]
|
|
||||||
|
|
||||||
integration_tests = [
|
|
||||||
'//infer/tests:integration_tests',
|
|
||||||
'//infer/tests:objc_tests',
|
|
||||||
'//infer/tests:objcpp_tests',
|
|
||||||
]
|
|
||||||
|
|
||||||
# ############### objc frontend tests ########################
|
|
||||||
|
|
||||||
objc_test_sources = glob(['objc/**/*.java'])
|
|
||||||
objc_frontend_test_deps = []
|
|
||||||
for test_source in objc_test_sources:
|
|
||||||
target_name = test_source.replace("/", "_")[:-len(".java")]
|
|
||||||
objc_frontend_test_deps.append(target_name)
|
|
||||||
|
|
||||||
java_test(
|
|
||||||
name=target_name,
|
|
||||||
srcs=[test_source],
|
|
||||||
deps=tests_dependencies,
|
|
||||||
visibility=integration_tests,
|
|
||||||
source='7',
|
|
||||||
target='7',
|
|
||||||
)
|
|
||||||
|
|
||||||
java_test(
|
|
||||||
name='objc_frontend_tests',
|
|
||||||
deps=[':' + x for x in objc_frontend_test_deps],
|
|
||||||
visibility=integration_tests,
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
# ############### objcpp frontend tests ########################
|
|
||||||
|
|
||||||
objcpp_test_sources = glob(['objcpp/**/*.java'])
|
|
||||||
objcpp_frontend_test_deps = []
|
|
||||||
for test_source in objcpp_test_sources:
|
|
||||||
target_name = test_source.replace("/", "_")[:-len(".java")]
|
|
||||||
objcpp_frontend_test_deps.append(target_name)
|
|
||||||
|
|
||||||
java_test(
|
|
||||||
name=target_name,
|
|
||||||
srcs=[test_source],
|
|
||||||
deps=tests_dependencies,
|
|
||||||
visibility=integration_tests,
|
|
||||||
source='7',
|
|
||||||
target='7',
|
|
||||||
)
|
|
||||||
|
|
||||||
java_test(
|
|
||||||
name='objcpp_frontend_tests',
|
|
||||||
deps=[':' + x for x in objcpp_frontend_test_deps],
|
|
||||||
visibility=integration_tests,
|
|
||||||
)
|
|
@ -1,86 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2014 - present Facebook, Inc.
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
* This source code is licensed under the BSD style license found in the
|
|
||||||
* LICENSE file in the root directory of this source tree. An additional grant
|
|
||||||
* of patent rights can be found in the PATENTS file in the same directory.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package frontend.objc;
|
|
||||||
|
|
||||||
import static org.hamcrest.MatcherAssert.assertThat;
|
|
||||||
import static utils.matchers.DotFilesEqual.dotFileEqualTo;
|
|
||||||
|
|
||||||
import com.google.common.collect.ImmutableList;
|
|
||||||
|
|
||||||
import org.junit.Rule;
|
|
||||||
import org.junit.Test;
|
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
import utils.DebuggableTemporaryFolder;
|
|
||||||
import utils.InferException;
|
|
||||||
import utils.InferRunner;
|
|
||||||
|
|
||||||
|
|
||||||
public class ArcExampleTest {
|
|
||||||
|
|
||||||
@Rule
|
|
||||||
public DebuggableTemporaryFolder folder = new DebuggableTemporaryFolder();
|
|
||||||
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void whenCaptureRunOnPropertyThenDotFilesAreTheSame()
|
|
||||||
throws InterruptedException, IOException, InferException {
|
|
||||||
|
|
||||||
String block_src = "infer/tests/codetoanalyze/objc/errors/memory_leaks_benchmark/ArcExample.m";
|
|
||||||
|
|
||||||
String block_dotty =
|
|
||||||
"infer/tests/codetoanalyze/objc/errors/memory_leaks_benchmark/ArcExample.dot";
|
|
||||||
|
|
||||||
ImmutableList<String> inferCmd =
|
|
||||||
InferRunner.createObjCInferCommandFrontendArc(folder, block_src);
|
|
||||||
File newDotFile = InferRunner.runInferFrontend(inferCmd);
|
|
||||||
assertThat(
|
|
||||||
"In the capture of " + block_src +
|
|
||||||
" the dotty files should be the same.",
|
|
||||||
newDotFile, dotFileEqualTo(block_dotty));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void whenCaptureInitlistThenDotFilesAreTheSame()
|
|
||||||
throws InterruptedException, IOException, InferException {
|
|
||||||
|
|
||||||
String block_src = "infer/tests/codetoanalyze/objc/frontend/vardecl/initlist.m";
|
|
||||||
|
|
||||||
String block_dotty =
|
|
||||||
"infer/tests/codetoanalyze/objc/frontend/vardecl/initlist.dot";
|
|
||||||
|
|
||||||
ImmutableList<String> inferCmd =
|
|
||||||
InferRunner.createObjCInferCommandFrontendArc(folder, block_src);
|
|
||||||
File newDotFile = InferRunner.runInferFrontend(inferCmd);
|
|
||||||
assertThat(
|
|
||||||
"In the capture of " + block_src +
|
|
||||||
" the dotty files should be the same.",
|
|
||||||
newDotFile, dotFileEqualTo(block_dotty));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void whenCaptureRunOnArcExampleThenDotFilesAreTheSame()
|
|
||||||
throws InterruptedException, IOException, InferException {
|
|
||||||
|
|
||||||
String arc_src = "infer/tests/codetoanalyze/objc/errors/memory_leaks_benchmark/arc_methods.m";
|
|
||||||
|
|
||||||
String arc_dotty =
|
|
||||||
"infer/tests/codetoanalyze/objc/errors/memory_leaks_benchmark/arc_methods.dot";
|
|
||||||
|
|
||||||
ImmutableList<String> inferCmd =
|
|
||||||
InferRunner.createObjCInferCommandFrontendArc(folder, arc_src);
|
|
||||||
File newDotFile = InferRunner.runInferFrontend(inferCmd);
|
|
||||||
assertThat(
|
|
||||||
"In the capture of " + arc_src + " the dotty files should be the same.",
|
|
||||||
newDotFile, dotFileEqualTo(arc_dotty));
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,208 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2013 - present Facebook, Inc.
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
* This source code is licensed under the BSD style license found in the
|
|
||||||
* LICENSE file in the root directory of this source tree. An additional grant
|
|
||||||
* of patent rights can be found in the PATENTS file in the same directory.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package frontend.objc;
|
|
||||||
|
|
||||||
import static org.hamcrest.MatcherAssert.assertThat;
|
|
||||||
import static utils.matchers.DotFilesEqual.dotFileEqualTo;
|
|
||||||
|
|
||||||
import com.google.common.collect.ImmutableList;
|
|
||||||
|
|
||||||
import org.junit.Assume;
|
|
||||||
import org.junit.Rule;
|
|
||||||
import org.junit.Test;
|
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
import utils.DebuggableTemporaryFolder;
|
|
||||||
import utils.InferException;
|
|
||||||
import utils.InferRunner;
|
|
||||||
|
|
||||||
|
|
||||||
public class BlockTest {
|
|
||||||
|
|
||||||
@Rule
|
|
||||||
public DebuggableTemporaryFolder folder = new DebuggableTemporaryFolder();
|
|
||||||
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void whenCaptureRunOnPropertyThenDotFilesAreTheSame()
|
|
||||||
throws InterruptedException, IOException, InferException {
|
|
||||||
|
|
||||||
String block_src =
|
|
||||||
"infer/tests/codetoanalyze/objc/frontend/" +
|
|
||||||
"block/block.m";
|
|
||||||
|
|
||||||
String block_dotty =
|
|
||||||
"infer/tests/codetoanalyze/objc/frontend/" +
|
|
||||||
"block/block.dot";
|
|
||||||
|
|
||||||
ImmutableList<String> inferCmd =
|
|
||||||
InferRunner.createObjCInferCommandFrontend(folder, block_src);
|
|
||||||
File newDotFile = InferRunner.runInferFrontend(inferCmd);
|
|
||||||
assertThat(
|
|
||||||
"In the capture of " + block_src +
|
|
||||||
" the dotty files should be the same.",
|
|
||||||
newDotFile, dotFileEqualTo(block_dotty));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void whenCaptureRunOnBlockVarThenDotFilesAreTheSame()
|
|
||||||
throws InterruptedException, IOException, InferException {
|
|
||||||
|
|
||||||
String block_src =
|
|
||||||
"infer/tests/codetoanalyze/objc/frontend/block/BlockVar.m";
|
|
||||||
|
|
||||||
String block_dotty =
|
|
||||||
"infer/tests/codetoanalyze/objc/frontend/block/BlockVar.dot";
|
|
||||||
|
|
||||||
ImmutableList<String> inferCmd =
|
|
||||||
InferRunner.createObjCInferCommandFrontend(folder, block_src);
|
|
||||||
File newDotFile = InferRunner.runInferFrontend(inferCmd);
|
|
||||||
assertThat(
|
|
||||||
"In the capture of " + block_src +
|
|
||||||
" the dotty files should be the same.",
|
|
||||||
newDotFile, dotFileEqualTo(block_dotty));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void whenCaptureRunOnBlockReleaseThenDotFilesAreTheSame()
|
|
||||||
throws InterruptedException, IOException, InferException {
|
|
||||||
|
|
||||||
String block_src =
|
|
||||||
"infer/tests/codetoanalyze/objc/frontend/block/block_release.m";
|
|
||||||
|
|
||||||
String block_dotty =
|
|
||||||
"infer/tests/codetoanalyze/objc/frontend/block/block_release.dot";
|
|
||||||
|
|
||||||
ImmutableList<String> inferCmd =
|
|
||||||
InferRunner.createiOSInferCommandFrontend(folder, block_src);
|
|
||||||
File newDotFile = InferRunner.runInferFrontend(inferCmd);
|
|
||||||
assertThat(
|
|
||||||
"In the capture of " + block_src +
|
|
||||||
" the dotty files should be the same.",
|
|
||||||
newDotFile, dotFileEqualTo(block_dotty));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void whenCaptureRunOnBlockNoArgsThenDotFilesAreTheSame()
|
|
||||||
throws InterruptedException, IOException, InferException {
|
|
||||||
|
|
||||||
String block_src =
|
|
||||||
"infer/tests/codetoanalyze/objc/frontend/block/block_no_args.m";
|
|
||||||
|
|
||||||
String block_dotty =
|
|
||||||
"infer/tests/codetoanalyze/objc/frontend/block/block_no_args.dot";
|
|
||||||
|
|
||||||
ImmutableList<String> inferCmd =
|
|
||||||
InferRunner.createObjCInferCommandFrontend(folder, block_src);
|
|
||||||
File newDotFile = InferRunner.runInferFrontend(inferCmd);
|
|
||||||
assertThat(
|
|
||||||
"In the capture of " + block_src +
|
|
||||||
" the dotty files should be the same.",
|
|
||||||
newDotFile, dotFileEqualTo(block_dotty));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void whenCaptureRunOnStaticThenDotFilesAreTheSame()
|
|
||||||
throws InterruptedException, IOException, InferException {
|
|
||||||
|
|
||||||
String block_src =
|
|
||||||
"infer/tests/codetoanalyze/objc/frontend/block/static.m";
|
|
||||||
|
|
||||||
String block_dotty =
|
|
||||||
"infer/tests/codetoanalyze/objc/frontend/block/static.dot";
|
|
||||||
|
|
||||||
ImmutableList<String> inferCmd =
|
|
||||||
InferRunner.createiOSInferCommandFrontend(folder, block_src);
|
|
||||||
File newDotFile = InferRunner.runInferFrontend(inferCmd);
|
|
||||||
assertThat(
|
|
||||||
"In the capture of " + block_src +
|
|
||||||
" the dotty files should be the same.",
|
|
||||||
newDotFile, dotFileEqualTo(block_dotty));
|
|
||||||
}
|
|
||||||
@Test
|
|
||||||
public void whenCaptureRunOnRetainCycleThenDotFilesAreTheSame()
|
|
||||||
throws InterruptedException, IOException, InferException {
|
|
||||||
|
|
||||||
String block_src =
|
|
||||||
"infer/tests/codetoanalyze/objc/frontend/block/retain_cycle.m";
|
|
||||||
|
|
||||||
String block_dotty =
|
|
||||||
"infer/tests/codetoanalyze/objc/frontend/block/retain_cycle.dot";
|
|
||||||
|
|
||||||
ImmutableList<String> inferCmd =
|
|
||||||
InferRunner.createiOSInferCommandFrontend(folder, block_src);
|
|
||||||
File newDotFile = InferRunner.runInferFrontend(inferCmd);
|
|
||||||
assertThat(
|
|
||||||
"In the capture of " + block_src +
|
|
||||||
" the dotty files should be the same.",
|
|
||||||
newDotFile, dotFileEqualTo(block_dotty));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void whenCaptureRunOnDispatchThenDotFilesAreTheSame()
|
|
||||||
throws InterruptedException, IOException, InferException {
|
|
||||||
|
|
||||||
String block_src =
|
|
||||||
"infer/tests/codetoanalyze/objc/frontend/block/dispatch.m";
|
|
||||||
|
|
||||||
String block_dotty =
|
|
||||||
"infer/tests/codetoanalyze/objc/frontend/block/dispatch.dot";
|
|
||||||
|
|
||||||
ImmutableList<String> inferCmd =
|
|
||||||
InferRunner.createiOSInferCommandFrontend(folder, block_src);
|
|
||||||
File newDotFile = InferRunner.runInferFrontend(inferCmd);
|
|
||||||
assertThat(
|
|
||||||
"In the capture of " + block_src +
|
|
||||||
" the dotty files should be the same.",
|
|
||||||
newDotFile, dotFileEqualTo(block_dotty));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void whenCaptureRunOnDispatch_exampleThenDotFilesAreTheSame()
|
|
||||||
throws InterruptedException, IOException, InferException {
|
|
||||||
|
|
||||||
String block_src =
|
|
||||||
"infer/tests/codetoanalyze/objc/frontend/block/dispatch_examples.m";
|
|
||||||
|
|
||||||
String block_dotty =
|
|
||||||
"infer/tests/codetoanalyze/objc/frontend/block/dispatch_examples.dot";
|
|
||||||
|
|
||||||
ImmutableList<String> inferCmd =
|
|
||||||
InferRunner.createiOSInferCommandFrontend(folder, block_src);
|
|
||||||
File newDotFile = InferRunner.runInferFrontend(inferCmd);
|
|
||||||
assertThat(
|
|
||||||
"In the capture of " + block_src +
|
|
||||||
" the dotty files should be the same.",
|
|
||||||
newDotFile, dotFileEqualTo(block_dotty));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void whenCaptureRunOnBlockit_exampleThenDotFilesAreTheSame()
|
|
||||||
throws InterruptedException, IOException, InferException {
|
|
||||||
|
|
||||||
String block_src =
|
|
||||||
"infer/tests/codetoanalyze/objc/frontend/block/block-it.m";
|
|
||||||
|
|
||||||
String block_dotty =
|
|
||||||
"infer/tests/codetoanalyze/objc/frontend/block/block-it.dot";
|
|
||||||
|
|
||||||
ImmutableList<String> inferCmd =
|
|
||||||
InferRunner.createiOSInferCommandFrontend(folder, block_src);
|
|
||||||
File newDotFile = InferRunner.runInferFrontend(inferCmd);
|
|
||||||
assertThat(
|
|
||||||
"In the capture of " + block_src +
|
|
||||||
" the dotty files should be the same.",
|
|
||||||
newDotFile, dotFileEqualTo(block_dotty));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
@ -1,149 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2013 - present Facebook, Inc.
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
* This source code is licensed under the BSD style license found in the
|
|
||||||
* LICENSE file in the root directory of this source tree. An additional grant
|
|
||||||
* of patent rights can be found in the PATENTS file in the same directory.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package frontend.objc;
|
|
||||||
|
|
||||||
import static org.hamcrest.MatcherAssert.assertThat;
|
|
||||||
import static utils.matchers.DotFilesEqual.dotFileEqualTo;
|
|
||||||
|
|
||||||
import com.google.common.collect.ImmutableList;
|
|
||||||
|
|
||||||
import org.junit.Rule;
|
|
||||||
import org.junit.Test;
|
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
import utils.DebuggableTemporaryFolder;
|
|
||||||
import utils.InferException;
|
|
||||||
import utils.InferRunner;
|
|
||||||
|
|
||||||
public class BoxingTest {
|
|
||||||
|
|
||||||
@Rule
|
|
||||||
public DebuggableTemporaryFolder folder = new DebuggableTemporaryFolder();
|
|
||||||
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void whenCaptureRunOnBoxingThenDotFilesAreTheSame()
|
|
||||||
throws InterruptedException, IOException, InferException {
|
|
||||||
String boxing_expr =
|
|
||||||
"infer/tests/codetoanalyze/" +
|
|
||||||
"objc/frontend/boxing/Boxing.m";
|
|
||||||
|
|
||||||
String boxing_dotty =
|
|
||||||
"infer/tests/codetoanalyze/" +
|
|
||||||
"objc/frontend/boxing/Boxing.dot";
|
|
||||||
|
|
||||||
ImmutableList<String> inferCmd =
|
|
||||||
InferRunner.createObjCInferCommandFrontend(folder, boxing_expr);
|
|
||||||
File newDotFile = InferRunner.runInferFrontend(inferCmd);
|
|
||||||
assertThat(
|
|
||||||
"In the capture of " + boxing_expr +
|
|
||||||
" the dotty files should be the same. " +
|
|
||||||
"In each procedure the translation of the boxing " +
|
|
||||||
"syntactic sugar is the same " +
|
|
||||||
"as the tranlation of the underlying method call.",
|
|
||||||
newDotFile, dotFileEqualTo(boxing_dotty));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void whenCaptureRunOnArray_literalThenDotFilesAreTheSame()
|
|
||||||
throws InterruptedException, IOException, InferException {
|
|
||||||
String arr_literal_expr =
|
|
||||||
"infer/tests/codetoanalyze/" +
|
|
||||||
"objc/frontend/boxing/array_literal.c";
|
|
||||||
|
|
||||||
String arr_literal_dotty =
|
|
||||||
"infer/tests/codetoanalyze/" +
|
|
||||||
"objc/frontend/boxing/array_literal.dot";
|
|
||||||
|
|
||||||
ImmutableList<String> inferCmd =
|
|
||||||
InferRunner.createObjCInferCommandFrontend(
|
|
||||||
folder,
|
|
||||||
arr_literal_expr);
|
|
||||||
File newDotFile = InferRunner.runInferFrontend(inferCmd);
|
|
||||||
assertThat(
|
|
||||||
"In the capture of " + arr_literal_expr +
|
|
||||||
" the dotty files should be the same. " +
|
|
||||||
"In each procedure the translation of the boxing " +
|
|
||||||
"syntactic sugar is the same " +
|
|
||||||
"as the tranlation of the underlying method call.",
|
|
||||||
newDotFile, dotFileEqualTo(arr_literal_dotty));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void whenCaptureRunOnDict_literalThenDotFilesAreTheSame()
|
|
||||||
throws InterruptedException, IOException, InferException {
|
|
||||||
String dict_literal_expr =
|
|
||||||
"infer/tests/codetoanalyze/" +
|
|
||||||
"objc/frontend/boxing/dict_literal.c";
|
|
||||||
|
|
||||||
String dict_literal_dotty =
|
|
||||||
"infer/tests/codetoanalyze/" +
|
|
||||||
"objc/frontend/boxing/dict_literal.dot";
|
|
||||||
|
|
||||||
ImmutableList<String> inferCmd =
|
|
||||||
InferRunner.createObjCInferCommandFrontend(
|
|
||||||
folder,
|
|
||||||
dict_literal_expr);
|
|
||||||
File newDotFile = InferRunner.runInferFrontend(inferCmd);
|
|
||||||
assertThat(
|
|
||||||
"In the capture of " + dict_literal_expr +
|
|
||||||
" the dotty files should be the same. " +
|
|
||||||
"In each procedure the translation of the boxing " +
|
|
||||||
"syntactic sugar is the same " +
|
|
||||||
"as the tranlation of the underlying method call.",
|
|
||||||
newDotFile, dotFileEqualTo(dict_literal_dotty));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void whenCaptureRunOnString_literalThenDotFilesAreTheSame()
|
|
||||||
throws InterruptedException, IOException, InferException {
|
|
||||||
String string_literal_expr =
|
|
||||||
"infer/tests/codetoanalyze/" +
|
|
||||||
"objc/frontend/boxing/string_literal.c";
|
|
||||||
|
|
||||||
String string_literal_dotty =
|
|
||||||
"infer/tests/codetoanalyze/" +
|
|
||||||
"objc/frontend/boxing/string_literal.dot";
|
|
||||||
|
|
||||||
ImmutableList<String> inferCmd =
|
|
||||||
InferRunner.createObjCInferCommandFrontend(
|
|
||||||
folder,
|
|
||||||
string_literal_expr);
|
|
||||||
File newDotFile = InferRunner.runInferFrontend(inferCmd);
|
|
||||||
assertThat(
|
|
||||||
"In the capture of " + string_literal_expr +
|
|
||||||
" the dotty files should be the same. " +
|
|
||||||
"In each procedure the translation of the boxing " +
|
|
||||||
"syntactic sugar is the same " +
|
|
||||||
"as the tranlation of the underlying method call.",
|
|
||||||
newDotFile, dotFileEqualTo(string_literal_dotty));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void whenCaptureRunOnForCollection_ThenDotFilesAreTheSame()
|
|
||||||
throws InterruptedException, IOException, InferException {
|
|
||||||
String array_expr =
|
|
||||||
"infer/tests/codetoanalyze/objc/frontend/boxing/array.m";
|
|
||||||
|
|
||||||
String array_dotty =
|
|
||||||
"infer/tests/codetoanalyze/objc/frontend/boxing/array.dot";
|
|
||||||
|
|
||||||
ImmutableList<String> inferCmd =
|
|
||||||
InferRunner.createObjCInferCommandFrontend(folder, array_expr);
|
|
||||||
File newDotFile = InferRunner.runInferFrontend(inferCmd);
|
|
||||||
assertThat(
|
|
||||||
"In the capture of " + array_expr +
|
|
||||||
" the dotty files should be the same.",
|
|
||||||
newDotFile, dotFileEqualTo(array_dotty));
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,78 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2013 - present Facebook, Inc.
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
* This source code is licensed under the BSD style license found in the
|
|
||||||
* LICENSE file in the root directory of this source tree. An additional grant
|
|
||||||
* of patent rights can be found in the PATENTS file in the same directory.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package frontend.objc;
|
|
||||||
|
|
||||||
import static org.hamcrest.MatcherAssert.assertThat;
|
|
||||||
import static utils.matchers.DotFilesEqual.dotFileEqualTo;
|
|
||||||
|
|
||||||
import com.google.common.collect.ImmutableList;
|
|
||||||
|
|
||||||
import org.junit.Rule;
|
|
||||||
import org.junit.Test;
|
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
import utils.DebuggableTemporaryFolder;
|
|
||||||
import utils.InferException;
|
|
||||||
import utils.InferRunner;
|
|
||||||
|
|
||||||
public class CategoryTest {
|
|
||||||
|
|
||||||
@Rule
|
|
||||||
public DebuggableTemporaryFolder folder = new DebuggableTemporaryFolder();
|
|
||||||
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void whenCaptureRunOnmainThenDotFilesAreTheSame()
|
|
||||||
throws InterruptedException, IOException, InferException {
|
|
||||||
String cat_expr =
|
|
||||||
"infer/tests/codetoanalyze/" +
|
|
||||||
"objc/errors/category_procdesc/main.c";
|
|
||||||
|
|
||||||
String cat_dotty =
|
|
||||||
"infer/tests/codetoanalyze/" +
|
|
||||||
"objc/errors/category_procdesc/main.dot";
|
|
||||||
|
|
||||||
ImmutableList<String> inferCmd =
|
|
||||||
InferRunner.createObjCInferCommandFrontend(folder, cat_expr);
|
|
||||||
File newDotFile = InferRunner.runInferFrontend(inferCmd);
|
|
||||||
assertThat(
|
|
||||||
"In the capture of " + cat_expr +
|
|
||||||
" the dotty files should be the same. " +
|
|
||||||
"In each procedure the translation of the boxing " +
|
|
||||||
"syntactic sugar is the same " +
|
|
||||||
"as the tranlation of the underlying method call.",
|
|
||||||
newDotFile, dotFileEqualTo(cat_dotty));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void whenCaptureRunOnEOCPersonThenDotFilesAreTheSame()
|
|
||||||
throws InterruptedException, IOException, InferException {
|
|
||||||
String cat_expr =
|
|
||||||
"infer/tests/codetoanalyze/" +
|
|
||||||
"objc/errors/category_procdesc/EOCPerson.m";
|
|
||||||
|
|
||||||
String cat_dotty =
|
|
||||||
"infer/tests/codetoanalyze/" +
|
|
||||||
"objc/errors/category_procdesc/EOCPerson.dot";
|
|
||||||
|
|
||||||
ImmutableList<String> inferCmd =
|
|
||||||
InferRunner.createObjCInferCommandFrontend(folder, cat_expr);
|
|
||||||
File newDotFile = InferRunner.runInferFrontend(inferCmd);
|
|
||||||
assertThat(
|
|
||||||
"In the capture of " + cat_expr +
|
|
||||||
" the dotty files should be the same. " +
|
|
||||||
"In each procedure the translation of the boxing " +
|
|
||||||
"syntactic sugar is the same " +
|
|
||||||
"as the tranlation of the underlying method call.",
|
|
||||||
newDotFile, dotFileEqualTo(cat_dotty));
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,51 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2013 - present Facebook, Inc.
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
* This source code is licensed under the BSD style license found in the
|
|
||||||
* LICENSE file in the root directory of this source tree. An additional grant
|
|
||||||
* of patent rights can be found in the PATENTS file in the same directory.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package frontend.objc;
|
|
||||||
|
|
||||||
import static org.hamcrest.MatcherAssert.assertThat;
|
|
||||||
import static utils.matchers.DotFilesEqual.dotFileEqualTo;
|
|
||||||
|
|
||||||
import com.google.common.collect.ImmutableList;
|
|
||||||
|
|
||||||
import org.junit.Rule;
|
|
||||||
import org.junit.Test;
|
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
import utils.DebuggableTemporaryFolder;
|
|
||||||
import utils.InferException;
|
|
||||||
import utils.InferRunner;
|
|
||||||
|
|
||||||
public class ConditionalOperatorTest {
|
|
||||||
|
|
||||||
@Rule
|
|
||||||
public DebuggableTemporaryFolder folder = new DebuggableTemporaryFolder();
|
|
||||||
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void whenCaptureRunCommaThenDotFilesAreTheSame()
|
|
||||||
throws InterruptedException, IOException, InferException {
|
|
||||||
String cond_src =
|
|
||||||
"infer/tests/codetoanalyze/objc/frontend/conditional_operation/ConditionalOperation.m";
|
|
||||||
|
|
||||||
String cond_dotty =
|
|
||||||
"infer/tests/codetoanalyze/objc/frontend/conditional_operation/ConditionalOperation.dot";
|
|
||||||
|
|
||||||
ImmutableList<String> inferCmd =
|
|
||||||
InferRunner.createObjCInferCommandFrontend(
|
|
||||||
folder,
|
|
||||||
cond_src);
|
|
||||||
File newDotFile = InferRunner.runInferFrontend(inferCmd);
|
|
||||||
assertThat(
|
|
||||||
"In the capture of " + cond_src + " the dotty files should be the same.",
|
|
||||||
newDotFile, dotFileEqualTo(cond_dotty));
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,52 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2013 - present Facebook, Inc.
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
* This source code is licensed under the BSD style license found in the
|
|
||||||
* LICENSE file in the root directory of this source tree. An additional grant
|
|
||||||
* of patent rights can be found in the PATENTS file in the same directory.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package frontend.objc;
|
|
||||||
|
|
||||||
import static org.hamcrest.MatcherAssert.assertThat;
|
|
||||||
import static utils.matchers.DotFilesEqual.dotFileEqualTo;
|
|
||||||
|
|
||||||
import com.google.common.collect.ImmutableList;
|
|
||||||
|
|
||||||
import org.junit.Rule;
|
|
||||||
import org.junit.Test;
|
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
import utils.DebuggableTemporaryFolder;
|
|
||||||
import utils.InferException;
|
|
||||||
import utils.InferRunner;
|
|
||||||
|
|
||||||
|
|
||||||
public class ExceptionTest {
|
|
||||||
|
|
||||||
@Rule
|
|
||||||
public DebuggableTemporaryFolder folder = new DebuggableTemporaryFolder();
|
|
||||||
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void whenCaptureRunOnTestThenDotFilesAreTheSame()
|
|
||||||
throws InterruptedException, IOException, InferException {
|
|
||||||
|
|
||||||
String exception_src =
|
|
||||||
"infer/tests/codetoanalyze/objc/frontend/exceptions/ExceptionExample.m";
|
|
||||||
|
|
||||||
String exception_dotty =
|
|
||||||
"infer/tests/codetoanalyze/objc/frontend/exceptions/ExceptionExample.dot";
|
|
||||||
|
|
||||||
ImmutableList<String> inferCmd =
|
|
||||||
InferRunner.createObjCInferCommandFrontend(folder, exception_src);
|
|
||||||
File newDotFile = InferRunner.runInferFrontend(inferCmd);
|
|
||||||
assertThat(
|
|
||||||
"In the capture of " + exception_src +
|
|
||||||
" the dotty files should be the same.",
|
|
||||||
newDotFile, dotFileEqualTo(exception_dotty));
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,51 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2013 - present Facebook, Inc.
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
* This source code is licensed under the BSD style license found in the
|
|
||||||
* LICENSE file in the root directory of this source tree. An additional grant
|
|
||||||
* of patent rights can be found in the PATENTS file in the same directory.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package frontend.objc;
|
|
||||||
|
|
||||||
import static org.hamcrest.MatcherAssert.assertThat;
|
|
||||||
import static utils.matchers.DotFilesEqual.dotFileEqualTo;
|
|
||||||
|
|
||||||
import com.google.common.collect.ImmutableList;
|
|
||||||
|
|
||||||
import org.junit.Rule;
|
|
||||||
import org.junit.Test;
|
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
import utils.DebuggableTemporaryFolder;
|
|
||||||
import utils.InferException;
|
|
||||||
import utils.InferRunner;
|
|
||||||
|
|
||||||
|
|
||||||
public class FastEnumerationTest {
|
|
||||||
|
|
||||||
@Rule
|
|
||||||
public DebuggableTemporaryFolder folder = new DebuggableTemporaryFolder();
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void whenCaptureRunOnTestThenDotFilesAreTheSame()
|
|
||||||
throws InterruptedException, IOException, InferException {
|
|
||||||
|
|
||||||
String exception_src =
|
|
||||||
"infer/tests/codetoanalyze/objc/frontend/fast_enumeration/Fast_enumeration.m";
|
|
||||||
|
|
||||||
String exception_dotty =
|
|
||||||
"infer/tests/codetoanalyze/objc/frontend/fast_enumeration/Fast_enumeration.dot";
|
|
||||||
|
|
||||||
ImmutableList<String> inferCmd =
|
|
||||||
InferRunner.createObjCInferCommandFrontend(folder, exception_src);
|
|
||||||
File newDotFile = InferRunner.runInferFrontend(inferCmd);
|
|
||||||
assertThat(
|
|
||||||
"In the capture of " + exception_src +
|
|
||||||
" the dotty files should be the same.",
|
|
||||||
newDotFile, dotFileEqualTo(exception_dotty));
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,92 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2013 - present Facebook, Inc.
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
* This source code is licensed under the BSD style license found in the
|
|
||||||
* LICENSE file in the root directory of this source tree. An additional grant
|
|
||||||
* of patent rights can be found in the PATENTS file in the same directory.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package frontend.objc;
|
|
||||||
|
|
||||||
import static org.hamcrest.MatcherAssert.assertThat;
|
|
||||||
import static utils.matchers.DotFilesEqual.dotFileEqualTo;
|
|
||||||
|
|
||||||
import com.google.common.collect.ImmutableList;
|
|
||||||
|
|
||||||
import org.junit.Rule;
|
|
||||||
import org.junit.Test;
|
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
import utils.DebuggableTemporaryFolder;
|
|
||||||
import utils.InferException;
|
|
||||||
import utils.InferRunner;
|
|
||||||
|
|
||||||
public class LateDefinedVarDeclTest {
|
|
||||||
|
|
||||||
@Rule
|
|
||||||
public DebuggableTemporaryFolder folder = new DebuggableTemporaryFolder();
|
|
||||||
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void whenCaptureRunLateDefinedStaticVarThenDotFilesAreTheSame()
|
|
||||||
throws InterruptedException, IOException, InferException {
|
|
||||||
String src_file =
|
|
||||||
"infer/tests/" +
|
|
||||||
"codetoanalyze/objc/frontend/vardecl/aclass.m";
|
|
||||||
|
|
||||||
String dot_file =
|
|
||||||
"infer/tests/" +
|
|
||||||
"codetoanalyze/objc/frontend/vardecl/aclass.dot";
|
|
||||||
|
|
||||||
ImmutableList<String> inferCmd =
|
|
||||||
InferRunner.createObjCInferCommandFrontend(folder, src_file);
|
|
||||||
File newDotFile = InferRunner.runInferFrontend(inferCmd);
|
|
||||||
assertThat(
|
|
||||||
"In the capture of " + src_file +
|
|
||||||
" the dotty files should be the same.",
|
|
||||||
newDotFile, dotFileEqualTo(dot_file));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void whenCaptureRunLateDefinedVarThenDotFilesAreTheSame()
|
|
||||||
throws InterruptedException, IOException, InferException {
|
|
||||||
String src_file =
|
|
||||||
"infer/tests/" +
|
|
||||||
"codetoanalyze/objc/frontend/vardecl/aclass_2.m";
|
|
||||||
|
|
||||||
String dot_file =
|
|
||||||
"infer/tests/" +
|
|
||||||
"codetoanalyze/objc/frontend/vardecl/aclass_2.dot";
|
|
||||||
|
|
||||||
ImmutableList<String> inferCmd =
|
|
||||||
InferRunner.createObjCInferCommandFrontend(folder, src_file);
|
|
||||||
File newDotFile = InferRunner.runInferFrontend(inferCmd);
|
|
||||||
assertThat(
|
|
||||||
"In the capture of " + src_file +
|
|
||||||
" the dotty files should be the same.",
|
|
||||||
newDotFile, dotFileEqualTo(dot_file));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void whenCaptureRunOnFunctionDeclWithOrderedVarDeclsThenDotFilesAreTheSame()
|
|
||||||
throws InterruptedException, IOException, InferException {
|
|
||||||
String src_file =
|
|
||||||
"infer/tests/" +
|
|
||||||
"codetoanalyze/objc/frontend/vardecl/last_af.m";
|
|
||||||
|
|
||||||
String dot_file =
|
|
||||||
"infer/tests/" +
|
|
||||||
"codetoanalyze/objc/frontend/vardecl/last_af.dot";
|
|
||||||
|
|
||||||
ImmutableList<String> inferCmd =
|
|
||||||
InferRunner.createObjCInferCommandFrontend(folder, src_file);
|
|
||||||
File newDotFile = InferRunner.runInferFrontend(inferCmd);
|
|
||||||
assertThat(
|
|
||||||
"In the capture of " + src_file +
|
|
||||||
" the dotty files should be the same.",
|
|
||||||
newDotFile, dotFileEqualTo(dot_file));
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,50 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2013 - present Facebook, Inc.
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
* This source code is licensed under the BSD style license found in the
|
|
||||||
* LICENSE file in the root directory of this source tree. An additional grant
|
|
||||||
* of patent rights can be found in the PATENTS file in the same directory.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package frontend.objc;
|
|
||||||
|
|
||||||
import static org.hamcrest.MatcherAssert.assertThat;
|
|
||||||
import static utils.matchers.DotFilesEqual.dotFileEqualTo;
|
|
||||||
|
|
||||||
import com.google.common.collect.ImmutableList;
|
|
||||||
|
|
||||||
import org.junit.Rule;
|
|
||||||
import org.junit.Test;
|
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
import utils.DebuggableTemporaryFolder;
|
|
||||||
import utils.InferException;
|
|
||||||
import utils.InferRunner;
|
|
||||||
|
|
||||||
public class MallocTest {
|
|
||||||
|
|
||||||
@Rule
|
|
||||||
public DebuggableTemporaryFolder folder = new DebuggableTemporaryFolder();
|
|
||||||
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void whenCaptureRunLateDefinedStaticVarThenDotFilesAreTheSame()
|
|
||||||
throws InterruptedException, IOException, InferException {
|
|
||||||
String src_file =
|
|
||||||
"infer/tests/codetoanalyze/objc/errors/npe/npe_malloc.m";
|
|
||||||
|
|
||||||
String dot_file =
|
|
||||||
"infer/tests/codetoanalyze/objc/errors/npe/npe_malloc.dot";
|
|
||||||
|
|
||||||
ImmutableList<String> inferCmd =
|
|
||||||
InferRunner.createObjCInferCommandFrontend(folder, src_file);
|
|
||||||
File newDotFile = InferRunner.runInferFrontend(inferCmd);
|
|
||||||
assertThat(
|
|
||||||
"In the capture of " + src_file +
|
|
||||||
" the dotty files should be the same.",
|
|
||||||
newDotFile, dotFileEqualTo(dot_file));
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,134 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2013 - present Facebook, Inc.
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
* This source code is licensed under the BSD style license found in the
|
|
||||||
* LICENSE file in the root directory of this source tree. An additional grant
|
|
||||||
* of patent rights can be found in the PATENTS file in the same directory.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package frontend.objc;
|
|
||||||
|
|
||||||
import static org.hamcrest.MatcherAssert.assertThat;
|
|
||||||
import static utils.matchers.DotFilesEqual.dotFileEqualTo;
|
|
||||||
|
|
||||||
import com.google.common.collect.ImmutableList;
|
|
||||||
|
|
||||||
import org.junit.Rule;
|
|
||||||
import org.junit.Test;
|
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
import utils.DebuggableTemporaryFolder;
|
|
||||||
import utils.InferException;
|
|
||||||
import utils.InferRunner;
|
|
||||||
|
|
||||||
|
|
||||||
public class MemoryLeakBenchmarkTest {
|
|
||||||
|
|
||||||
@Rule
|
|
||||||
public DebuggableTemporaryFolder folder = new DebuggableTemporaryFolder();
|
|
||||||
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void whenCaptureRunOnMemoryLeakExampleThenDotFilesAreTheSame()
|
|
||||||
throws InterruptedException, IOException, InferException {
|
|
||||||
String ml_expr =
|
|
||||||
"infer/tests/codetoanalyze/" +
|
|
||||||
"objc/errors/memory_leaks_benchmark/MemoryLeakExample.m";
|
|
||||||
|
|
||||||
String ml_dotty =
|
|
||||||
"infer/tests/codetoanalyze/" +
|
|
||||||
"objc/errors/memory_leaks_benchmark/MemoryLeakExample.dot";
|
|
||||||
|
|
||||||
ImmutableList<String> inferCmd =
|
|
||||||
InferRunner.createiOSInferCommandFrontend(folder, ml_expr);
|
|
||||||
File newDotFile = InferRunner.runInferFrontend(inferCmd);
|
|
||||||
assertThat(
|
|
||||||
"In the capture of " + ml_expr +
|
|
||||||
" the dotty files should be the same.",
|
|
||||||
newDotFile, dotFileEqualTo(ml_dotty));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void whenCaptureRunOnRetainReleaseExampleThenDotFilesAreTheSame()
|
|
||||||
throws InterruptedException, IOException, InferException {
|
|
||||||
String ml_expr =
|
|
||||||
"infer/tests/codetoanalyze/" +
|
|
||||||
"objc/errors/memory_leaks_benchmark/RetainReleaseExample.m";
|
|
||||||
|
|
||||||
String ml_dotty =
|
|
||||||
"infer/tests/codetoanalyze/" +
|
|
||||||
"objc/errors/memory_leaks_benchmark/RetainReleaseExample.dot";
|
|
||||||
|
|
||||||
ImmutableList<String> inferCmd =
|
|
||||||
InferRunner.createiOSInferCommandFrontend(folder, ml_expr);
|
|
||||||
File newDotFile = InferRunner.runInferFrontend(inferCmd);
|
|
||||||
assertThat(
|
|
||||||
"In the capture of " + ml_expr +
|
|
||||||
" the dotty files should be the same.",
|
|
||||||
newDotFile, dotFileEqualTo(ml_dotty));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void whenCaptureRunOnRetainReleaseExample2ThenDotFilesAreTheSame()
|
|
||||||
throws InterruptedException, IOException, InferException {
|
|
||||||
String ml_expr =
|
|
||||||
"infer/tests/codetoanalyze/" +
|
|
||||||
"objc/errors/memory_leaks_benchmark/RetainReleaseExample2.m";
|
|
||||||
|
|
||||||
String ml_dotty =
|
|
||||||
"infer/tests/codetoanalyze/" +
|
|
||||||
"objc/errors/memory_leaks_benchmark/RetainReleaseExample2.dot";
|
|
||||||
|
|
||||||
ImmutableList<String> inferCmd =
|
|
||||||
InferRunner.createiOSInferCommandFrontend(folder, ml_expr);
|
|
||||||
File newDotFile = InferRunner.runInferFrontend(inferCmd);
|
|
||||||
assertThat(
|
|
||||||
"In the capture of " + ml_expr +
|
|
||||||
" the dotty files should be the same.",
|
|
||||||
newDotFile, dotFileEqualTo(ml_dotty));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void whenCaptureRunOnAutoreleaseExampleThenDotFilesAreTheSame()
|
|
||||||
throws InterruptedException, IOException, InferException {
|
|
||||||
String ml_expr =
|
|
||||||
"infer/tests/codetoanalyze/" +
|
|
||||||
"objc/errors/memory_leaks_benchmark/AutoreleaseExample.m";
|
|
||||||
|
|
||||||
String ml_dotty =
|
|
||||||
"infer/tests/codetoanalyze/" +
|
|
||||||
"objc/errors/memory_leaks_benchmark/AutoreleaseExample.dot";
|
|
||||||
|
|
||||||
ImmutableList<String> inferCmd =
|
|
||||||
InferRunner.createiOSInferCommandFrontend(folder, ml_expr);
|
|
||||||
File newDotFile = InferRunner.runInferFrontend(inferCmd);
|
|
||||||
assertThat(
|
|
||||||
"In the capture of " + ml_expr +
|
|
||||||
" the dotty files should be the same.",
|
|
||||||
newDotFile, dotFileEqualTo(ml_dotty));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void whenCaptureRunOnTollBridgeExampleThenDotFilesAreTheSame()
|
|
||||||
throws InterruptedException, IOException, InferException {
|
|
||||||
String ml_expr =
|
|
||||||
"infer/tests/codetoanalyze/" +
|
|
||||||
"objc/errors/memory_leaks_benchmark/TollBridgeExample.m";
|
|
||||||
|
|
||||||
String ml_dotty =
|
|
||||||
"infer/tests/codetoanalyze/" +
|
|
||||||
"objc/errors/memory_leaks_benchmark/TollBridgeExample.dot";
|
|
||||||
|
|
||||||
ImmutableList<String> inferCmd =
|
|
||||||
InferRunner.createiOSInferCommandFrontend(folder, ml_expr);
|
|
||||||
File newDotFile = InferRunner.runInferFrontend(inferCmd);
|
|
||||||
assertThat(
|
|
||||||
"In the capture of " + ml_expr +
|
|
||||||
" the dotty files should be the same.",
|
|
||||||
newDotFile, dotFileEqualTo(ml_dotty));
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,50 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2014 - present Facebook, Inc.
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
* This source code is licensed under the BSD style license found in the
|
|
||||||
* LICENSE file in the root directory of this source tree. An additional grant
|
|
||||||
* of patent rights can be found in the PATENTS file in the same directory.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package frontend.objc;
|
|
||||||
|
|
||||||
import static org.hamcrest.MatcherAssert.assertThat;
|
|
||||||
import static utils.matchers.DotFilesEqual.dotFileEqualTo;
|
|
||||||
|
|
||||||
import com.google.common.collect.ImmutableList;
|
|
||||||
|
|
||||||
import org.junit.Assume;
|
|
||||||
import org.junit.Rule;
|
|
||||||
import org.junit.Test;
|
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
import utils.DebuggableTemporaryFolder;
|
|
||||||
import utils.InferException;
|
|
||||||
import utils.InferRunner;
|
|
||||||
|
|
||||||
|
|
||||||
public class NSAssertTest {
|
|
||||||
|
|
||||||
@Rule
|
|
||||||
public DebuggableTemporaryFolder folder = new DebuggableTemporaryFolder();
|
|
||||||
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void whenCaptureRunOnPropertyThenDotFilesAreTheSame()
|
|
||||||
throws InterruptedException, IOException, InferException {
|
|
||||||
|
|
||||||
String src = "infer/tests/codetoanalyze/objc/frontend/assertions/NSAssert_example.m";
|
|
||||||
|
|
||||||
String dotty = "infer/tests/codetoanalyze/objc/frontend/assertions/NSAssert_example.dot";
|
|
||||||
|
|
||||||
ImmutableList<String> inferCmd =
|
|
||||||
InferRunner.createObjCInferCommandFrontendArc(folder, src);
|
|
||||||
File newDotFile = InferRunner.runInferFrontend(inferCmd);
|
|
||||||
assertThat(
|
|
||||||
"In the capture of " + src + " the dotty files should be the same.",
|
|
||||||
newDotFile, dotFileEqualTo(dotty));
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,48 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2014 - present Facebook, Inc.
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
* This source code is licensed under the BSD style license found in the
|
|
||||||
* LICENSE file in the root directory of this source tree. An additional grant
|
|
||||||
* of patent rights can be found in the PATENTS file in the same directory.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package frontend.objc;
|
|
||||||
|
|
||||||
import static org.hamcrest.MatcherAssert.assertThat;
|
|
||||||
import static utils.matchers.DotFilesEqual.dotFileEqualTo;
|
|
||||||
|
|
||||||
import com.google.common.collect.ImmutableList;
|
|
||||||
|
|
||||||
import org.junit.Rule;
|
|
||||||
import org.junit.Test;
|
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
import utils.DebuggableTemporaryFolder;
|
|
||||||
import utils.InferException;
|
|
||||||
import utils.InferRunner;
|
|
||||||
|
|
||||||
|
|
||||||
public class NonnullAttributeTest {
|
|
||||||
|
|
||||||
@Rule
|
|
||||||
public DebuggableTemporaryFolder folder = new DebuggableTemporaryFolder();
|
|
||||||
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void whenCaptureRunOnNonnullAttributeExampleThenDotFilesAreTheSame()
|
|
||||||
throws InterruptedException, IOException, InferException {
|
|
||||||
|
|
||||||
String src = "infer/tests/codetoanalyze/objc/errors/npe/Nonnull_attribute_example.m";
|
|
||||||
|
|
||||||
String dotty = "infer/tests/codetoanalyze/objc/errors/npe/Nonnull_attribute_example.dot";
|
|
||||||
|
|
||||||
ImmutableList<String> inferCmd = InferRunner.createObjCInferCommandFrontendArc(folder, src);
|
|
||||||
File newDotFile = InferRunner.runInferFrontend(inferCmd);
|
|
||||||
assertThat(
|
|
||||||
"In the capture of " + src + " the dotty files should be the same.",
|
|
||||||
newDotFile, dotFileEqualTo(dotty));
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,51 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2014 - present Facebook, Inc.
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
* This source code is licensed under the BSD style license found in the
|
|
||||||
* LICENSE file in the root directory of this source tree. An additional grant
|
|
||||||
* of patent rights can be found in the PATENTS file in the same directory.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package frontend.objc;
|
|
||||||
|
|
||||||
import static org.hamcrest.MatcherAssert.assertThat;
|
|
||||||
import static utils.matchers.DotFilesEqual.dotFileEqualTo;
|
|
||||||
|
|
||||||
import com.google.common.collect.ImmutableList;
|
|
||||||
|
|
||||||
import org.junit.Rule;
|
|
||||||
import org.junit.Test;
|
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
import utils.DebuggableTemporaryFolder;
|
|
||||||
import utils.InferException;
|
|
||||||
import utils.InferRunner;
|
|
||||||
|
|
||||||
|
|
||||||
public class PredefinedExpressionTest {
|
|
||||||
|
|
||||||
@Rule
|
|
||||||
public DebuggableTemporaryFolder folder = new DebuggableTemporaryFolder();
|
|
||||||
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void whenCaptureRunOnPropertyThenDotFilesAreTheSame()
|
|
||||||
throws InterruptedException, IOException, InferException {
|
|
||||||
|
|
||||||
String src = "infer/tests/codetoanalyze/objc/frontend/predefined_expr/PredefinedExprExample.m";
|
|
||||||
|
|
||||||
String dotty =
|
|
||||||
"infer/tests/codetoanalyze/objc/frontend/predefined_expr/PredefinedExprExample.dot";
|
|
||||||
|
|
||||||
ImmutableList<String> inferCmd =
|
|
||||||
InferRunner.createObjCInferCommandFrontendArc(folder, src);
|
|
||||||
File newDotFile = InferRunner.runInferFrontend(inferCmd);
|
|
||||||
assertThat(
|
|
||||||
"In the capture of " + src +
|
|
||||||
" the dotty files should be the same.",
|
|
||||||
newDotFile, dotFileEqualTo(dotty));
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,172 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2013 - present Facebook, Inc.
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
* This source code is licensed under the BSD style license found in the
|
|
||||||
* LICENSE file in the root directory of this source tree. An additional grant
|
|
||||||
* of patent rights can be found in the PATENTS file in the same directory.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package frontend.objc;
|
|
||||||
|
|
||||||
import static org.hamcrest.MatcherAssert.assertThat;
|
|
||||||
import static utils.matchers.DotFilesEqual.dotFileEqualTo;
|
|
||||||
|
|
||||||
import com.google.common.collect.ImmutableList;
|
|
||||||
|
|
||||||
import org.junit.Rule;
|
|
||||||
import org.junit.Test;
|
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
import utils.DebuggableTemporaryFolder;
|
|
||||||
import utils.InferException;
|
|
||||||
import utils.InferRunner;
|
|
||||||
|
|
||||||
|
|
||||||
public class PropertyTest {
|
|
||||||
|
|
||||||
@Rule
|
|
||||||
public DebuggableTemporaryFolder folder = new DebuggableTemporaryFolder();
|
|
||||||
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void whenCaptureRunOnPropertyThenDotFilesAreTheSame()
|
|
||||||
throws InterruptedException, IOException, InferException {
|
|
||||||
String property_expr =
|
|
||||||
"infer/tests/codetoanalyze/" +
|
|
||||||
"objc/frontend/property/main_car.m";
|
|
||||||
|
|
||||||
String property_dotty =
|
|
||||||
"infer/tests/codetoanalyze/" +
|
|
||||||
"objc/frontend/property/main_car.dot";
|
|
||||||
|
|
||||||
ImmutableList<String> inferCmd =
|
|
||||||
InferRunner.createObjCInferCommandFrontend(folder, property_expr);
|
|
||||||
File newDotFile = InferRunner.runInferFrontend(inferCmd);
|
|
||||||
assertThat(
|
|
||||||
"In the capture of " + property_expr +
|
|
||||||
" the dotty files should be the same.",
|
|
||||||
newDotFile, dotFileEqualTo(property_dotty));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void whenCaptureRunOnDynamicPropertyThenDotFilesAreTheSame()
|
|
||||||
throws InterruptedException, IOException, InferException {
|
|
||||||
String property_expr =
|
|
||||||
"infer/tests/codetoanalyze/" +
|
|
||||||
"objc/frontend/property/aclass.m";
|
|
||||||
|
|
||||||
String property_dotty =
|
|
||||||
"infer/tests/codetoanalyze/" +
|
|
||||||
"objc/frontend/property/aclass.dot";
|
|
||||||
|
|
||||||
ImmutableList<String> inferCmd =
|
|
||||||
InferRunner.createObjCInferCommandFrontend(folder, property_expr);
|
|
||||||
File newDotFile = InferRunner.runInferFrontend(inferCmd);
|
|
||||||
assertThat(
|
|
||||||
"In the capture of " + property_expr +
|
|
||||||
" the dotty files should be the same.",
|
|
||||||
newDotFile, dotFileEqualTo(property_dotty));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void whenCaptureRunOnPropertyInProtocolThenDotFilesAreTheSame()
|
|
||||||
throws InterruptedException, IOException, InferException {
|
|
||||||
String property_expr =
|
|
||||||
"infer/tests/codetoanalyze/objc/frontend/" +
|
|
||||||
"property_in_protocol/Test.m";
|
|
||||||
|
|
||||||
String property_dotty =
|
|
||||||
"infer/tests/codetoanalyze/objc/frontend/" +
|
|
||||||
"property_in_protocol/Test.dot";
|
|
||||||
|
|
||||||
ImmutableList<String> inferCmd =
|
|
||||||
InferRunner.createObjCInferCommandFrontend(folder, property_expr);
|
|
||||||
File newDotFile = InferRunner.runInferFrontend(inferCmd);
|
|
||||||
assertThat(
|
|
||||||
"In the capture of " + property_expr +
|
|
||||||
" the dotty files should be the same.",
|
|
||||||
newDotFile, dotFileEqualTo(property_dotty));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void whenCaptureRunOnPropertyImplSetterThenDotFilesAreTheSame()
|
|
||||||
throws InterruptedException, IOException, InferException {
|
|
||||||
String property_expr =
|
|
||||||
"infer/tests/codetoanalyze/objc/frontend/" +
|
|
||||||
"property/PropertyImplSetter.m";
|
|
||||||
|
|
||||||
String property_dotty =
|
|
||||||
"infer/tests/codetoanalyze/objc/frontend/" +
|
|
||||||
"property/PropertyImplSetter.dot";
|
|
||||||
|
|
||||||
ImmutableList<String> inferCmd =
|
|
||||||
InferRunner.createObjCInferCommandFrontend(folder, property_expr);
|
|
||||||
File newDotFile = InferRunner.runInferFrontend(inferCmd);
|
|
||||||
assertThat(
|
|
||||||
"In the capture of " + property_expr +
|
|
||||||
" the dotty files should be the same.",
|
|
||||||
newDotFile, dotFileEqualTo(property_dotty));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void whenCaptureRunOnPropertyAttributesThenDotFilesAreTheSame()
|
|
||||||
throws InterruptedException, IOException, InferException {
|
|
||||||
String property_expr =
|
|
||||||
"infer/tests/codetoanalyze/objc/frontend/" +
|
|
||||||
"property/PropertyAttributes.m";
|
|
||||||
|
|
||||||
String property_dotty =
|
|
||||||
"infer/tests/codetoanalyze/objc/frontend/" +
|
|
||||||
"property/PropertyAttributes.dot";
|
|
||||||
|
|
||||||
ImmutableList<String> inferCmd =
|
|
||||||
InferRunner.createObjCInferCommandFrontend(folder, property_expr);
|
|
||||||
File newDotFile = InferRunner.runInferFrontend(inferCmd);
|
|
||||||
assertThat(
|
|
||||||
"In the capture of " + property_expr +
|
|
||||||
" the dotty files should be the same.",
|
|
||||||
newDotFile, dotFileEqualTo(property_dotty));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void whenCaptureRunOnProperty_getterThenDotFilesAreTheSame()
|
|
||||||
throws InterruptedException, IOException, InferException {
|
|
||||||
String property_expr =
|
|
||||||
"infer/tests/codetoanalyze/objc/frontend/property/Property_getter.m";
|
|
||||||
|
|
||||||
String property_dotty =
|
|
||||||
"infer/tests/codetoanalyze/objc/frontend/property/Property_getter.dot";
|
|
||||||
|
|
||||||
ImmutableList<String> inferCmd =
|
|
||||||
InferRunner.createObjCInferCommandFrontend(folder, property_expr);
|
|
||||||
File newDotFile = InferRunner.runInferFrontend(inferCmd);
|
|
||||||
assertThat(
|
|
||||||
"In the capture of " + property_expr +
|
|
||||||
" the dotty files should be the same.",
|
|
||||||
newDotFile, dotFileEqualTo(property_dotty));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void whenCaptureRunOnPropertyCustomAccessorThenDotFilesAreTheSame()
|
|
||||||
throws InterruptedException, IOException, InferException {
|
|
||||||
String property_expr =
|
|
||||||
"infer/tests/codetoanalyze/objc/frontend/property/PropertyCustomAccessor.m";
|
|
||||||
|
|
||||||
String property_dotty =
|
|
||||||
"infer/tests/codetoanalyze/objc/frontend/property/PropertyCustomAccessor.dot";
|
|
||||||
|
|
||||||
ImmutableList<String> inferCmd =
|
|
||||||
InferRunner.createObjCInferCommandFrontend(folder, property_expr);
|
|
||||||
File newDotFile = InferRunner.runInferFrontend(inferCmd);
|
|
||||||
assertThat(
|
|
||||||
"In the capture of " + property_expr +
|
|
||||||
" the dotty files should be the same.",
|
|
||||||
newDotFile, dotFileEqualTo(property_dotty));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
@ -1,80 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2013 - present Facebook, Inc.
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
* This source code is licensed under the BSD style license found in the
|
|
||||||
* LICENSE file in the root directory of this source tree. An additional grant
|
|
||||||
* of patent rights can be found in the PATENTS file in the same directory.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package frontend.objc;
|
|
||||||
|
|
||||||
import static org.hamcrest.MatcherAssert.assertThat;
|
|
||||||
import static utils.matchers.DotFilesEqual.dotFileEqualTo;
|
|
||||||
|
|
||||||
import com.google.common.collect.ImmutableList;
|
|
||||||
|
|
||||||
import org.junit.Rule;
|
|
||||||
import org.junit.Test;
|
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
import utils.DebuggableTemporaryFolder;
|
|
||||||
import utils.InferException;
|
|
||||||
import utils.InferRunner;
|
|
||||||
|
|
||||||
public class ProtocolTest {
|
|
||||||
|
|
||||||
@Rule
|
|
||||||
public DebuggableTemporaryFolder folder = new DebuggableTemporaryFolder();
|
|
||||||
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void whenCaptureRunOnProtocolThenDotFilesAreTheSame()
|
|
||||||
throws InterruptedException, IOException, InferException {
|
|
||||||
String protocol_expr =
|
|
||||||
"infer/tests/codetoanalyze/" +
|
|
||||||
"objc/frontend/protocol/protocol.m";
|
|
||||||
|
|
||||||
String protocol_dotty =
|
|
||||||
"infer/tests/codetoanalyze/" +
|
|
||||||
"objc/frontend/protocol/protocol.dot";
|
|
||||||
|
|
||||||
ImmutableList<String> inferCmd =
|
|
||||||
InferRunner.createObjCInferCommandFrontend(
|
|
||||||
folder,
|
|
||||||
protocol_expr);
|
|
||||||
File newDotFile = InferRunner.runInferFrontend(inferCmd);
|
|
||||||
assertThat(
|
|
||||||
"In the capture of " + protocol_expr +
|
|
||||||
" the dotty files should be the same. " +
|
|
||||||
"In each procedure the translation of the boxing " +
|
|
||||||
"syntactic sugar is the same " +
|
|
||||||
"as the tranlation of the underlying method call.",
|
|
||||||
newDotFile, dotFileEqualTo(protocol_dotty));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void whenCaptureRunOnBicycleThenDotFilesAreTheSame()
|
|
||||||
throws InterruptedException, IOException, InferException {
|
|
||||||
String protocol_expr =
|
|
||||||
"infer/tests/codetoanalyze/" +
|
|
||||||
"objc/errors/protocol_procdesc/main.c";
|
|
||||||
|
|
||||||
String protocol_dotty =
|
|
||||||
"infer/tests/codetoanalyze/" +
|
|
||||||
"objc/errors/protocol_procdesc/main.dot";
|
|
||||||
|
|
||||||
ImmutableList<String> inferCmd =
|
|
||||||
InferRunner.createObjCInferCommandFrontend(
|
|
||||||
folder,
|
|
||||||
protocol_expr);
|
|
||||||
File newDotFile = InferRunner.runInferFrontend(inferCmd);
|
|
||||||
assertThat(
|
|
||||||
"In the capture of " + protocol_expr +
|
|
||||||
" the dotty files should be the same.",
|
|
||||||
newDotFile, dotFileEqualTo(protocol_dotty));
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,55 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2013 - present Facebook, Inc.
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
* This source code is licensed under the BSD style license found in the
|
|
||||||
* LICENSE file in the root directory of this source tree. An additional grant
|
|
||||||
* of patent rights can be found in the PATENTS file in the same directory.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package frontend.objc;
|
|
||||||
|
|
||||||
import static org.hamcrest.MatcherAssert.assertThat;
|
|
||||||
import static utils.matchers.DotFilesEqual.dotFileEqualTo;
|
|
||||||
|
|
||||||
import com.google.common.collect.ImmutableList;
|
|
||||||
|
|
||||||
import org.junit.Rule;
|
|
||||||
import org.junit.Test;
|
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
import utils.DebuggableTemporaryFolder;
|
|
||||||
import utils.InferException;
|
|
||||||
import utils.InferRunner;
|
|
||||||
|
|
||||||
|
|
||||||
public class ReturnTest {
|
|
||||||
|
|
||||||
@Rule
|
|
||||||
public DebuggableTemporaryFolder folder = new DebuggableTemporaryFolder();
|
|
||||||
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void whenCaptureRunOnVoidReturnThenDotFilesAreTheSame()
|
|
||||||
throws InterruptedException, IOException, InferException {
|
|
||||||
|
|
||||||
String src_file =
|
|
||||||
"infer/tests/codetoanalyze/objc/frontend/" +
|
|
||||||
"returnstmt/void_return.m";
|
|
||||||
|
|
||||||
String dotty_file =
|
|
||||||
"infer/tests/codetoanalyze/objc/frontend/" +
|
|
||||||
"returnstmt/void_return.dot";
|
|
||||||
|
|
||||||
ImmutableList<String> inferCmd =
|
|
||||||
InferRunner.createObjCInferCommandFrontend(folder, src_file);
|
|
||||||
File newDotFile = InferRunner.runInferFrontend(inferCmd);
|
|
||||||
assertThat(
|
|
||||||
"In the capture of " + src_file +
|
|
||||||
" the dotty files should be the same.",
|
|
||||||
newDotFile, dotFileEqualTo(dotty_file));
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,93 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2013 - present Facebook, Inc.
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
* This source code is licensed under the BSD style license found in the
|
|
||||||
* LICENSE file in the root directory of this source tree. An additional grant
|
|
||||||
* of patent rights can be found in the PATENTS file in the same directory.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package frontend.objc;
|
|
||||||
|
|
||||||
import static org.hamcrest.MatcherAssert.assertThat;
|
|
||||||
import static utils.matchers.DotFilesEqual.dotFileEqualTo;
|
|
||||||
|
|
||||||
import com.google.common.collect.ImmutableList;
|
|
||||||
|
|
||||||
import org.junit.Rule;
|
|
||||||
import org.junit.Test;
|
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
import utils.DebuggableTemporaryFolder;
|
|
||||||
import utils.InferException;
|
|
||||||
import utils.InferRunner;
|
|
||||||
|
|
||||||
|
|
||||||
public class StaticSelf {
|
|
||||||
|
|
||||||
@Rule
|
|
||||||
public DebuggableTemporaryFolder folder = new DebuggableTemporaryFolder();
|
|
||||||
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void whenCaptureRunOnStaticThenDotFilesAreTheSame()
|
|
||||||
throws InterruptedException, IOException, InferException {
|
|
||||||
String property_expr =
|
|
||||||
"infer/tests/codetoanalyze/" +
|
|
||||||
"objc/frontend/self_static/static.m";
|
|
||||||
|
|
||||||
String property_dotty =
|
|
||||||
"infer/tests/codetoanalyze/" +
|
|
||||||
"objc/frontend/self_static/static.dot";
|
|
||||||
|
|
||||||
ImmutableList<String> inferCmd =
|
|
||||||
InferRunner.createObjCInferCommandFrontend(
|
|
||||||
folder,
|
|
||||||
property_expr);
|
|
||||||
File newDotFile = InferRunner.runInferFrontend(inferCmd);
|
|
||||||
assertThat(
|
|
||||||
"In the capture of " + property_expr +
|
|
||||||
" the dotty files should be the same.",
|
|
||||||
newDotFile, dotFileEqualTo(property_dotty));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void whenCaptureRunOnSuperTestThenDotFilesAreTheSame()
|
|
||||||
throws InterruptedException, IOException, InferException {
|
|
||||||
String expr = "infer/tests/codetoanalyze/objc/errors/field_superclass/SuperExample.m";
|
|
||||||
|
|
||||||
String dotty = "infer/tests/codetoanalyze/objc/errors/field_superclass/SuperExample.dot";
|
|
||||||
|
|
||||||
ImmutableList<String> inferCmd =
|
|
||||||
InferRunner.createObjCInferCommandFrontend(
|
|
||||||
folder,
|
|
||||||
expr);
|
|
||||||
File newDotFile = InferRunner.runInferFrontend(inferCmd);
|
|
||||||
assertThat(
|
|
||||||
"In the capture of " + expr +
|
|
||||||
" the dotty files should be the same.",
|
|
||||||
newDotFile, dotFileEqualTo(dotty));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void whenCaptureRunOnSelfThenDotFilesAreTheSame()
|
|
||||||
throws InterruptedException, IOException, InferException {
|
|
||||||
String expr = "infer/tests/codetoanalyze/objc/frontend/self_static/Self.m";
|
|
||||||
|
|
||||||
String dotty = "infer/tests/codetoanalyze/objc/frontend/self_static/Self.dot";
|
|
||||||
|
|
||||||
ImmutableList<String> inferCmd =
|
|
||||||
InferRunner.createObjCInferCommandFrontend(
|
|
||||||
folder,
|
|
||||||
expr);
|
|
||||||
File newDotFile = InferRunner.runInferFrontend(inferCmd);
|
|
||||||
assertThat(
|
|
||||||
"In the capture of " + expr +
|
|
||||||
" the dotty files should be the same.",
|
|
||||||
newDotFile, dotFileEqualTo(dotty));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
@ -1,72 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2013 - present Facebook, Inc.
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
* This source code is licensed under the BSD style license found in the
|
|
||||||
* LICENSE file in the root directory of this source tree. An additional grant
|
|
||||||
* of patent rights can be found in the PATENTS file in the same directory.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package frontend.objc;
|
|
||||||
|
|
||||||
import static org.hamcrest.MatcherAssert.assertThat;
|
|
||||||
import static utils.matchers.DotFilesEqual.dotFileEqualTo;
|
|
||||||
|
|
||||||
import com.google.common.collect.ImmutableList;
|
|
||||||
|
|
||||||
import org.junit.Rule;
|
|
||||||
import org.junit.Test;
|
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
import utils.DebuggableTemporaryFolder;
|
|
||||||
import utils.InferException;
|
|
||||||
import utils.InferRunner;
|
|
||||||
|
|
||||||
public class StringTest {
|
|
||||||
|
|
||||||
@Rule
|
|
||||||
public DebuggableTemporaryFolder folder = new DebuggableTemporaryFolder();
|
|
||||||
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void whenCaptureRunOnStringLiteralThenDotFilesAreTheSame()
|
|
||||||
throws InterruptedException, IOException, InferException {
|
|
||||||
String string_expr =
|
|
||||||
"infer/tests/codetoanalyze/" +
|
|
||||||
"objc/frontend/strings/string_literal.m";
|
|
||||||
|
|
||||||
String string_dotty =
|
|
||||||
"infer/tests/codetoanalyze/" +
|
|
||||||
"objc/frontend/strings/string_literal.dot";
|
|
||||||
|
|
||||||
ImmutableList<String> inferCmd =
|
|
||||||
InferRunner.createObjCInferCommandFrontend(folder, string_expr);
|
|
||||||
File newDotFile = InferRunner.runInferFrontend(inferCmd);
|
|
||||||
assertThat(
|
|
||||||
"In the capture of " + string_expr +
|
|
||||||
" the dotty files should be the same.",
|
|
||||||
newDotFile, dotFileEqualTo(string_dotty));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void whenCaptureRunOnGlobalStringLiteralThenDotFilesAreTheSame()
|
|
||||||
throws InterruptedException, IOException, InferException {
|
|
||||||
String string_expr =
|
|
||||||
"infer/tests/codetoanalyze/" +
|
|
||||||
"objc/frontend/strings/global_string_literal.m";
|
|
||||||
|
|
||||||
String string_dotty =
|
|
||||||
"infer/tests/codetoanalyze/" +
|
|
||||||
"objc/frontend/strings/global_string_literal.dot";
|
|
||||||
|
|
||||||
ImmutableList<String> inferCmd =
|
|
||||||
InferRunner.createObjCInferCommandFrontend(folder, string_expr);
|
|
||||||
File newDotFile = InferRunner.runInferFrontend(inferCmd);
|
|
||||||
assertThat(
|
|
||||||
"In the capture of " + string_expr +
|
|
||||||
" the dotty files should be the same.",
|
|
||||||
newDotFile, dotFileEqualTo(string_dotty));
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,96 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2013 - present Facebook, Inc.
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
* This source code is licensed under the BSD style license found in the
|
|
||||||
* LICENSE file in the root directory of this source tree. An additional grant
|
|
||||||
* of patent rights can be found in the PATENTS file in the same directory.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package frontend.objc;
|
|
||||||
|
|
||||||
import static org.hamcrest.MatcherAssert.assertThat;
|
|
||||||
import static utils.matchers.DotFilesEqual.dotFileEqualTo;
|
|
||||||
|
|
||||||
import com.google.common.collect.ImmutableList;
|
|
||||||
|
|
||||||
import org.junit.Rule;
|
|
||||||
import org.junit.Test;
|
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
import utils.DebuggableTemporaryFolder;
|
|
||||||
import utils.InferException;
|
|
||||||
import utils.InferRunner;
|
|
||||||
|
|
||||||
public class SubclassTest {
|
|
||||||
|
|
||||||
@Rule
|
|
||||||
public DebuggableTemporaryFolder folder = new DebuggableTemporaryFolder();
|
|
||||||
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void whenCaptureRunOnStringLiteralThenDotFilesAreTheSame()
|
|
||||||
throws InterruptedException, IOException, InferException {
|
|
||||||
String myClass_expr =
|
|
||||||
"infer/tests/codetoanalyze/" +
|
|
||||||
"objc/frontend/subclass/MyClass.m";
|
|
||||||
|
|
||||||
String string_dotty =
|
|
||||||
"infer/tests/codetoanalyze/" +
|
|
||||||
"objc/frontend/subclass/MyClass.dot";
|
|
||||||
|
|
||||||
ImmutableList<String> inferCmd =
|
|
||||||
InferRunner.createObjCInferCommandFrontend(
|
|
||||||
folder,
|
|
||||||
myClass_expr);
|
|
||||||
File newDotFile = InferRunner.runInferFrontend(inferCmd);
|
|
||||||
assertThat(
|
|
||||||
"In the capture of " + myClass_expr +
|
|
||||||
" the dotty files should be the same.",
|
|
||||||
newDotFile, dotFileEqualTo(string_dotty));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void whenCaptureRunOnGlobalStringLiteralThenDotFilesAreTheSame()
|
|
||||||
throws InterruptedException, IOException, InferException {
|
|
||||||
String mySubClass_expr =
|
|
||||||
"infer/tests/codetoanalyze/" +
|
|
||||||
"objc/frontend/subclass/MySubClass.m";
|
|
||||||
|
|
||||||
String string_dotty =
|
|
||||||
"infer/tests/codetoanalyze/" +
|
|
||||||
"objc/frontend/subclass/MySubClass.dot";
|
|
||||||
|
|
||||||
ImmutableList<String> inferCmd =
|
|
||||||
InferRunner.createObjCInferCommandFrontend(
|
|
||||||
folder,
|
|
||||||
mySubClass_expr);
|
|
||||||
File newDotFile = InferRunner.runInferFrontend(inferCmd);
|
|
||||||
assertThat(
|
|
||||||
"In the capture of " + mySubClass_expr +
|
|
||||||
" the dotty files should be the same.",
|
|
||||||
newDotFile, dotFileEqualTo(string_dotty));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void whenCaptureRunOnMainThenDotFilesAreTheSame()
|
|
||||||
throws InterruptedException, IOException, InferException {
|
|
||||||
String mySubClass_expr = "infer/tests/codetoanalyze/objc/frontend/subclass/main.c";
|
|
||||||
|
|
||||||
String string_dotty = "infer/tests/codetoanalyze/objc/frontend/subclass/main.dot";
|
|
||||||
|
|
||||||
ImmutableList<String> inferCmd =
|
|
||||||
InferRunner.createObjCInferCommandFrontend(
|
|
||||||
folder,
|
|
||||||
mySubClass_expr);
|
|
||||||
File newDotFile = InferRunner.runInferFrontend(inferCmd);
|
|
||||||
assertThat(
|
|
||||||
"In the capture of " + mySubClass_expr +
|
|
||||||
" the dotty files should be the same.",
|
|
||||||
newDotFile, dotFileEqualTo(string_dotty));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
@ -1,96 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2013 - present Facebook, Inc.
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
* This source code is licensed under the BSD style license found in the
|
|
||||||
* LICENSE file in the root directory of this source tree. An additional grant
|
|
||||||
* of patent rights can be found in the PATENTS file in the same directory.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package frontend.objc;
|
|
||||||
|
|
||||||
import static org.hamcrest.MatcherAssert.assertThat;
|
|
||||||
import static utils.matchers.DotFilesEqual.dotFileEqualTo;
|
|
||||||
|
|
||||||
import com.google.common.collect.ImmutableList;
|
|
||||||
|
|
||||||
import org.junit.Rule;
|
|
||||||
import org.junit.Test;
|
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
import utils.DebuggableTemporaryFolder;
|
|
||||||
import utils.InferException;
|
|
||||||
import utils.InferRunner;
|
|
||||||
|
|
||||||
|
|
||||||
public class TypesTest {
|
|
||||||
|
|
||||||
@Rule
|
|
||||||
public DebuggableTemporaryFolder folder = new DebuggableTemporaryFolder();
|
|
||||||
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void whenCaptureRunOnTestLoopThenDotFilesAreTheSame()
|
|
||||||
throws InterruptedException, IOException, InferException {
|
|
||||||
|
|
||||||
String block_src =
|
|
||||||
"infer/tests/codetoanalyze/objc/frontend/" +
|
|
||||||
"types/testloop.m";
|
|
||||||
|
|
||||||
String block_dotty =
|
|
||||||
"infer/tests/codetoanalyze/objc/frontend/" +
|
|
||||||
"types/testloop.dot";
|
|
||||||
|
|
||||||
ImmutableList<String> inferCmd =
|
|
||||||
InferRunner.createObjCInferCommandFrontend(folder, block_src);
|
|
||||||
File newDotFile = InferRunner.runInferFrontend(inferCmd);
|
|
||||||
assertThat(
|
|
||||||
"In the capture of " + block_src +
|
|
||||||
" the dotty files should be the same.",
|
|
||||||
newDotFile, dotFileEqualTo(block_dotty));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void whenCaptureRunOnAttributesThenDotFilesAreTheSame()
|
|
||||||
throws InterruptedException, IOException, InferException {
|
|
||||||
|
|
||||||
String block_src =
|
|
||||||
"infer/tests/codetoanalyze/objc/frontend/" +
|
|
||||||
"types/attributes.m";
|
|
||||||
|
|
||||||
String block_dotty =
|
|
||||||
"infer/tests/codetoanalyze/objc/frontend/" +
|
|
||||||
"types/attributes.dot";
|
|
||||||
|
|
||||||
ImmutableList<String> inferCmd =
|
|
||||||
InferRunner.createObjCInferCommandFrontendArc(folder, block_src);
|
|
||||||
File newDotFile = InferRunner.runInferFrontend(inferCmd);
|
|
||||||
assertThat(
|
|
||||||
"In the capture of " + block_src +
|
|
||||||
" the dotty files should be the same.",
|
|
||||||
newDotFile, dotFileEqualTo(block_dotty));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void whenCaptureRunOnVoidCall()
|
|
||||||
throws InterruptedException, IOException, InferException {
|
|
||||||
|
|
||||||
String block_src =
|
|
||||||
"infer/tests/codetoanalyze/objc/frontend/" +
|
|
||||||
"types/void_call.m";
|
|
||||||
|
|
||||||
String block_dotty =
|
|
||||||
"infer/tests/codetoanalyze/objc/frontend/" +
|
|
||||||
"types/void_call.dot";
|
|
||||||
|
|
||||||
ImmutableList<String> inferCmd =
|
|
||||||
InferRunner.createObjCInferCommandFrontendArc(folder, block_src);
|
|
||||||
File newDotFile = InferRunner.runInferFrontend(inferCmd);
|
|
||||||
assertThat(
|
|
||||||
"In the capture of " + block_src +
|
|
||||||
" the dotty files should be the same.",
|
|
||||||
newDotFile, dotFileEqualTo(block_dotty));
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,52 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2013 - present Facebook, Inc.
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
* This source code is licensed under the BSD style license found in the
|
|
||||||
* LICENSE file in the root directory of this source tree. An additional grant
|
|
||||||
* of patent rights can be found in the PATENTS file in the same directory.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package frontend.objcpp;
|
|
||||||
|
|
||||||
import static org.hamcrest.MatcherAssert.assertThat;
|
|
||||||
import static utils.matchers.DotFilesEqual.dotFileEqualTo;
|
|
||||||
|
|
||||||
import com.google.common.collect.ImmutableList;
|
|
||||||
|
|
||||||
import org.junit.Rule;
|
|
||||||
import org.junit.Test;
|
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
import utils.DebuggableTemporaryFolder;
|
|
||||||
import utils.InferException;
|
|
||||||
import utils.InferRunner;
|
|
||||||
|
|
||||||
public class FuncOverloadingTest {
|
|
||||||
|
|
||||||
@Rule
|
|
||||||
public DebuggableTemporaryFolder folder = new DebuggableTemporaryFolder();
|
|
||||||
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void whenCaptureRunSwitchStmtThenDotFilesAreTheSame()
|
|
||||||
throws InterruptedException, IOException, InferException {
|
|
||||||
String switch_src =
|
|
||||||
"infer/tests/codetoanalyze/objcpp/frontend/" +
|
|
||||||
"funcoverloading/af_test.mm";
|
|
||||||
|
|
||||||
String switch_dotty =
|
|
||||||
"infer/tests/codetoanalyze/objcpp/frontend/" +
|
|
||||||
"funcoverloading/af_test.dot";
|
|
||||||
|
|
||||||
ImmutableList<String> inferCmd =
|
|
||||||
InferRunner.createObjCPPInferCommand(folder, switch_src);
|
|
||||||
File newDotFile = InferRunner.runInferFrontend(inferCmd);
|
|
||||||
assertThat(
|
|
||||||
"In the capture of " + switch_src +
|
|
||||||
" the dotty files should be the same.",
|
|
||||||
newDotFile, dotFileEqualTo(switch_dotty));
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,49 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2016 - present Facebook, Inc.
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
* This source code is licensed under the BSD style license found in the
|
|
||||||
* LICENSE file in the root directory of this source tree. An additional grant
|
|
||||||
* of patent rights can be found in the PATENTS file in the same directory.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package frontend.objcpp;
|
|
||||||
|
|
||||||
import static org.hamcrest.MatcherAssert.assertThat;
|
|
||||||
import static utils.matchers.DotFilesEqual.dotFileEqualTo;
|
|
||||||
|
|
||||||
import com.google.common.collect.ImmutableList;
|
|
||||||
|
|
||||||
import org.junit.Rule;
|
|
||||||
import org.junit.Test;
|
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
import utils.DebuggableTemporaryFolder;
|
|
||||||
import utils.InferException;
|
|
||||||
import utils.InferRunner;
|
|
||||||
|
|
||||||
public class GlobalConstTest {
|
|
||||||
|
|
||||||
@Rule
|
|
||||||
public DebuggableTemporaryFolder folder = new DebuggableTemporaryFolder();
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void whenCaptureRunSwitchStmtThenDotFilesAreTheSame()
|
|
||||||
throws InterruptedException, IOException, InferException {
|
|
||||||
String switch_src =
|
|
||||||
"infer/tests/codetoanalyze/objcpp/frontend/global_const/global_const.mm";
|
|
||||||
|
|
||||||
String switch_dotty =
|
|
||||||
"infer/tests/codetoanalyze/objcpp/frontend/global_const/global_const.mm.dot";
|
|
||||||
|
|
||||||
ImmutableList<String> inferCmd =
|
|
||||||
InferRunner.createObjCPPInferCommand(folder, switch_src);
|
|
||||||
File newDotFile = InferRunner.runInferFrontend(inferCmd);
|
|
||||||
assertThat(
|
|
||||||
"In the capture of " + switch_src +
|
|
||||||
" the dotty files should be the same.",
|
|
||||||
newDotFile, dotFileEqualTo(switch_dotty));
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,72 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2015 - present Facebook, Inc.
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
* This source code is licensed under the BSD style license found in the
|
|
||||||
* LICENSE file in the root directory of this source tree. An additional grant
|
|
||||||
* of patent rights can be found in the PATENTS file in the same directory.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package utils;
|
|
||||||
|
|
||||||
import static org.hamcrest.MatcherAssert.assertThat;
|
|
||||||
import static utils.matchers.DotFilesEqual.dotFileEqualTo;
|
|
||||||
|
|
||||||
import com.google.common.collect.ImmutableList;
|
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
import utils.DebuggableTemporaryFolder;
|
|
||||||
import utils.InferException;
|
|
||||||
import utils.InferRunner;
|
|
||||||
|
|
||||||
public class ClangFrontendUtils {
|
|
||||||
public static void createAndCompareCppDotFiles (
|
|
||||||
DebuggableTemporaryFolder folder,
|
|
||||||
String pathToSrcFile,
|
|
||||||
boolean headers)
|
|
||||||
throws InterruptedException, IOException, InferException {
|
|
||||||
|
|
||||||
String test_src = pathToSrcFile;
|
|
||||||
String test_dotty = pathToSrcFile + ".dot";
|
|
||||||
ImmutableList<String> inferCmd;
|
|
||||||
if (headers)
|
|
||||||
inferCmd = InferRunner.createCPPInferCommandIncludeHeaders(folder, test_src);
|
|
||||||
else
|
|
||||||
inferCmd = InferRunner.createCPPInferCommandFrontend(folder, test_src);
|
|
||||||
File newDotFile = InferRunner.runInferFrontend(inferCmd);
|
|
||||||
assertThat(
|
|
||||||
"In the capture of " + test_src +
|
|
||||||
" the dotty files should be the same.",
|
|
||||||
newDotFile, dotFileEqualTo(test_dotty));
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void createAndCompareCppDotFiles(DebuggableTemporaryFolder folder,
|
|
||||||
String pathToSrcFile)
|
|
||||||
throws InterruptedException, IOException, InferException {
|
|
||||||
createAndCompareCppDotFiles(folder, pathToSrcFile, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void createAndCompareCppDotFilesIncludeHeaders(DebuggableTemporaryFolder folder,
|
|
||||||
String pathToSrcFile)
|
|
||||||
throws InterruptedException, IOException, InferException {
|
|
||||||
createAndCompareCppDotFiles(folder, pathToSrcFile, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void createAndCompareCDotFiles(DebuggableTemporaryFolder folder, String pathToSrcFile)
|
|
||||||
throws InterruptedException, IOException, InferException {
|
|
||||||
|
|
||||||
String test_src = pathToSrcFile;
|
|
||||||
String test_dotty = pathToSrcFile + ".dot";
|
|
||||||
ImmutableList<String> inferCmd =
|
|
||||||
InferRunner.createCInferCommandFrontend(
|
|
||||||
folder,
|
|
||||||
test_src);
|
|
||||||
File newDotFile = InferRunner.runInferFrontend(inferCmd);
|
|
||||||
assertThat(
|
|
||||||
"In the capture of " + test_src +
|
|
||||||
" the dotty files should be the same.",
|
|
||||||
newDotFile, dotFileEqualTo(test_dotty));
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Reference in new issue