<s> """<STR_LIT>""" <EOL> import json <EOL> import TestGyp <EOL> found = '<STR_LIT>' <EOL> found_all = '<STR_LIT>' <EOL> not_found = '<STR_LIT>' <EOL> def _CreateConfigFile ( files , targets ) : <EOL> """<STR_LIT>""" <EOL> f = open ( '<STR_LIT>' , '<STR_LIT:w>' ) <EOL> to_write = { '<STR_LIT>' : files , '<STR_LIT>' : targets } <EOL> json . dump ( to_write , f ) <EOL> f . close ( ) <EOL> def _CreateBogusConfigFile ( ) : <EOL> f = open ( '<STR_LIT>' , '<STR_LIT:w>' ) <EOL> f . write ( '<STR_LIT>' ) <EOL> f . close ( ) <EOL> def _ReadOutputFileContents ( ) : <EOL> f = open ( '<STR_LIT>' , '<STR_LIT:r>' ) <EOL> result = json . load ( f ) <EOL> f . close ( ) <EOL> return result <EOL> test = TestGyp . TestGypCustom ( format = '<STR_LIT>' ) <EOL> def CommonArgs ( ) : <EOL> return ( '<STR_LIT>' , <EOL> '<STR_LIT>' ) <EOL> def run_analyzer ( * args , ** kw ) : <EOL> """<STR_LIT>""" <EOL> args += CommonArgs ( ) <EOL> test . run_gyp ( '<STR_LIT>' , * args , ** kw ) <EOL> def run_analyzer2 ( * args , ** kw ) : <EOL> """<STR_LIT>""" <EOL> args += CommonArgs ( ) <EOL> test . run_gyp ( '<STR_LIT>' , * args , ** kw ) <EOL> def run_analyzer3 ( * args , ** kw ) : <EOL> """<STR_LIT>""" <EOL> args += CommonArgs ( ) <EOL> test . run_gyp ( '<STR_LIT>' , * args , ** kw ) <EOL> def run_analyzer4 ( * args , ** kw ) : <EOL> """<STR_LIT>""" <EOL> args += CommonArgs ( ) <EOL> test . run_gyp ( '<STR_LIT>' , * args , ** kw ) <EOL> def EnsureContains ( targets = set ( ) , matched = False , build_targets = set ( ) ) : <EOL> """<STR_LIT>""" <EOL> result = _ReadOutputFileContents ( ) <EOL> if result . get ( '<STR_LIT:error>' , None ) : <EOL> print '<STR_LIT>' , result . get ( '<STR_LIT:error>' ) <EOL> test . fail_test ( ) <EOL> if result . get ( '<STR_LIT>' , None ) : <EOL> print '<STR_LIT>' , result . get ( '<STR_LIT>' ) <EOL> test . fail_test ( ) <EOL> actual_targets = set ( result [ '<STR_LIT>' ] ) <EOL> if actual_targets != targets : <EOL> print '<STR_LIT>' , actual_targets , '<STR_LIT>' , targets <EOL> test . fail_test ( ) <EOL> actual_build_targets = set ( result [ '<STR_LIT>' ] ) <EOL> if actual_build_targets != build_targets : <EOL> print '<STR_LIT>' , actual_build_targets , '<STR_LIT>' , build_targets <EOL> test . fail_test ( ) <EOL> if matched and result [ '<STR_LIT:status>' ] != found : <EOL> print '<STR_LIT>' , found , '<STR_LIT>' , result [ '<STR_LIT:status>' ] <EOL> test . fail_test ( ) <EOL> elif not matched and result [ '<STR_LIT:status>' ] != not_found : <EOL> print '<STR_LIT>' , not_found , '<STR_LIT>' , result [ '<STR_LIT:status>' ] <EOL> test . fail_test ( ) <EOL> def EnsureMatchedAll ( targets ) : <EOL> result = _ReadOutputFileContents ( ) <EOL> if result . get ( '<STR_LIT:error>' , None ) : <EOL> print '<STR_LIT>' , result . get ( '<STR_LIT:error>' ) <EOL> test . fail_test ( ) <EOL> if result . get ( '<STR_LIT>' , None ) : <EOL> print '<STR_LIT>' , result . get ( '<STR_LIT>' ) <EOL> test . fail_test ( ) <EOL> if result [ '<STR_LIT:status>' ] != found_all : <EOL> print '<STR_LIT>' , found_all , '<STR_LIT>' , result [ '<STR_LIT:status>' ] <EOL> test . fail_test ( ) <EOL> actual_targets = set ( result [ '<STR_LIT>' ] ) <EOL> if actual_targets != targets : <EOL> print '<STR_LIT>' , actual_targets , '<STR_LIT>' , targets <EOL> test . fail_test ( ) <EOL> def EnsureError ( expected_error_string ) : <EOL> """<STR_LIT>""" <EOL> result = _ReadOutputFileContents ( ) <EOL> if result . get ( '<STR_LIT:error>' , '<STR_LIT>' ) . find ( expected_error_string ) == - <NUM_LIT:1> : <EOL> print '<STR_LIT>' , result . get ( '<STR_LIT:error>' , '<STR_LIT>' ) , '<STR_LIT>' , expected_error_string <EOL> test . fail_test ( ) <EOL> def EnsureStdoutContains ( expected_error_string ) : <EOL> if test . stdout ( ) . find ( expected_error_string ) == - <NUM_LIT:1> : <EOL> print '<STR_LIT>' , test . stdout ( ) , '<STR_LIT>' , expected_error_string <EOL> test . fail_test ( ) <EOL> def EnsureInvalidTargets ( expected_invalid_targets ) : <EOL> """<STR_LIT>""" <EOL> result = _ReadOutputFileContents ( ) <EOL> actual_invalid_targets = set ( result [ '<STR_LIT>' ] ) <EOL> if actual_invalid_targets != expected_invalid_targets : <EOL> print '<STR_LIT>' , actual_invalid_targets , '<STR_LIT>' , expected_invalid_targets <EOL> test . fail_test ( ) <EOL> test . run_gyp ( '<STR_LIT>' ) <EOL> EnsureStdoutContains ( '<STR_LIT>' ) <EOL> test . run_gyp ( '<STR_LIT>' , '<STR_LIT>' , <EOL> '<STR_LIT>' ) <EOL> EnsureError ( '<STR_LIT>' ) <EOL> _CreateConfigFile ( [ '<STR_LIT>' ] , [ '<STR_LIT>' ] ) <EOL> run_analyzer ( ) <EOL> EnsureInvalidTargets ( { '<STR_LIT>' } ) <EOL> _CreateBogusConfigFile ( ) <EOL> run_analyzer ( ) <EOL> EnsureError ( '<STR_LIT>' ) <EOL> _CreateConfigFile ( [ '<STR_LIT>' ] , [ ] ) <EOL> run_analyzer ( ) <EOL> EnsureContains ( matched = True , build_targets = { '<STR_LIT>' } ) <EOL> _CreateConfigFile ( [ '<STR_LIT>' ] , [ ] ) <EOL> run_analyzer ( ) <EOL> EnsureContains ( matched = False ) <EOL> _CreateConfigFile ( [ '<STR_LIT>' ] , [ ] ) <EOL> run_analyzer ( '<STR_LIT>' ) <EOL> EnsureContains ( matched = True , build_targets = { '<STR_LIT>' } ) <EOL> _CreateConfigFile ( [ '<STR_LIT>' , '<STR_LIT>' ] , [ ] ) <EOL> run_analyzer ( ) <EOL> EnsureContains ( ) <EOL> _CreateConfigFile ( [ '<STR_LIT>' , '<STR_LIT>' ] , [ ] ) <EOL> run_analyzer ( ) <EOL> EnsureContains ( ) <EOL> _CreateConfigFile ( [ '<STR_LIT>' , '<STR_LIT>' ] , [ ] ) <EOL> run_analyzer ( ) <EOL> EnsureContains ( matched = True , build_targets = { '<STR_LIT>' , '<STR_LIT>' } ) <EOL> _CreateConfigFile ( [ '<STR_LIT>' ] , [ ] ) <EOL> run_analyzer ( ) <EOL> EnsureContains ( matched = True , build_targets = { '<STR_LIT>' } ) <EOL> _CreateConfigFile ( [ '<STR_LIT>' ] , [ ] ) <EOL> run_analyzer ( ) <EOL> EnsureContains ( matched = False ) <EOL> _CreateConfigFile ( [ '<STR_LIT>' ] , [ ] ) <EOL> run_analyzer ( ) <EOL> EnsureContains ( matched = True , build_targets = { '<STR_LIT>' } ) <EOL> _CreateConfigFile ( [ '<STR_LIT>' ] , [ ] ) <EOL> run_analyzer ( ) <EOL> EnsureContains ( matched = False ) <EOL> _CreateConfigFile ( [ '<STR_LIT>' ] , [ ] ) <EOL> run_analyzer ( ) <EOL> EnsureContains ( matched = True , build_targets = { '<STR_LIT>' } ) <EOL> _CreateConfigFile ( [ '<STR_LIT>' ] , [ ] ) <EOL> run_analyzer ( ) <EOL> EnsureContains ( matched = True , build_targets = { '<STR_LIT>' , '<STR_LIT>' } ) <EOL> _CreateConfigFile ( [ '<STR_LIT>' ] , [ ] ) <EOL> run_analyzer ( ) <EOL> EnsureContains ( matched = True , build_targets = { '<STR_LIT>' } ) <EOL> _CreateConfigFile ( [ '<STR_LIT>' , '<STR_LIT>' ] , [ '<STR_LIT>' , '<STR_LIT>' ] ) <EOL> run_analyzer ( ) <EOL> EnsureContains ( matched = True , targets = { '<STR_LIT>' } , build_targets = { '<STR_LIT>' , '<STR_LIT>' } ) <EOL> _CreateConfigFile ( [ '<STR_LIT>' , '<STR_LIT>' ] , [ '<STR_LIT>' ] ) <EOL> run_analyzer ( ) <EOL> EnsureContains ( matched = True , build_targets = { '<STR_LIT>' , '<STR_LIT>' } ) <EOL> _CreateConfigFile ( [ '<STR_LIT>' , '<STR_LIT>' ] , [ '<STR_LIT>' , '<STR_LIT>' ] ) <EOL> run_analyzer ( ) <EOL> EnsureContains ( matched = True , build_targets = { '<STR_LIT>' , '<STR_LIT>' } ) <EOL> _CreateConfigFile ( [ '<STR_LIT>' ] , [ '<STR_LIT>' ] ) <EOL> run_analyzer ( ) <EOL> EnsureContains ( matched = True , build_targets = { '<STR_LIT>' } ) <EOL> _CreateConfigFile ( [ '<STR_LIT>' ] , [ ] ) <EOL> run_analyzer ( ) <EOL> EnsureContains ( matched = True , build_targets = { '<STR_LIT>' } ) <EOL> _CreateConfigFile ( [ '<STR_LIT>' , '<STR_LIT>' ] , [ ] ) <EOL> run_analyzer ( ) <EOL> EnsureContains ( matched = True , build_targets = { '<STR_LIT>' , '<STR_LIT>' } ) <EOL> _CreateConfigFile ( [ '<STR_LIT>' ] , [ '<STR_LIT>' ] ) <EOL> run_analyzer ( ) <EOL> EnsureContains ( matched = True , targets = { '<STR_LIT>' } , build_targets = { '<STR_LIT>' } ) <EOL> _CreateConfigFile ( [ '<STR_LIT>' ] , [ ] ) <EOL> run_analyzer ( ) <EOL> EnsureContains ( matched = True , build_targets = { '<STR_LIT>' } ) <EOL> _CreateConfigFile ( [ '<STR_LIT>' ] , [ ] ) <EOL> run_analyzer ( ) <EOL> EnsureContains ( matched = True , build_targets = { '<STR_LIT>' } ) <EOL> _CreateConfigFile ( [ '<STR_LIT>' ] , [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT:foo>' , '<STR_LIT>' ] ) <EOL> run_analyzer2 ( ) <EOL> EnsureContains ( matched = True , targets = { '<STR_LIT>' , '<STR_LIT:foo>' } , build_targets = { '<STR_LIT>' } ) <EOL> _CreateConfigFile ( [ '<STR_LIT>' ] , <EOL> [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT:foo>' , '<STR_LIT>' ] ) <EOL> run_analyzer2 ( ) <EOL> EnsureContains ( matched = True , targets = { '<STR_LIT>' , '<STR_LIT:foo>' } , build_targets = { '<STR_LIT>' } ) <EOL> _CreateConfigFile ( [ '<STR_LIT>' ] , [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT:foo>' , '<STR_LIT>' ] ) <EOL> run_analyzer2 ( ) <EOL> EnsureContains ( matched = True , targets = { '<STR_LIT>' , '<STR_LIT:foo>' } , build_targets = { '<STR_LIT>' } ) <EOL> _CreateConfigFile ( [ '<STR_LIT>' ] , [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT:foo>' , '<STR_LIT>' ] ) <EOL> run_analyzer2 ( ) <EOL> EnsureContains ( matched = True , targets = { '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' } , <EOL> build_targets = { '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' } ) <EOL> _CreateConfigFile ( [ '<STR_LIT>' ] , [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT:foo>' , '<STR_LIT>' ] ) <EOL> run_analyzer2 ( '<STR_LIT>' ) <EOL> EnsureMatchedAll ( { '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT:foo>' , '<STR_LIT>' } ) <EOL> _CreateConfigFile ( [ '<STR_LIT>' , '<STR_LIT>' ] , [ '<STR_LIT:a>' ] ) <EOL> run_analyzer3 ( ) <EOL> EnsureContains ( matched = True , targets = { '<STR_LIT:a>' } , build_targets = { '<STR_LIT:a>' , '<STR_LIT:b>' } ) <EOL> _CreateConfigFile ( [ '<STR_LIT>' ] , [ '<STR_LIT:a>' ] ) <EOL> run_analyzer3 ( ) <EOL> EnsureContains ( matched = True , targets = { '<STR_LIT:a>' } , build_targets = { '<STR_LIT:a>' , '<STR_LIT:b>' } ) <EOL> _CreateConfigFile ( [ '<STR_LIT>' ] , [ ] ) <EOL> run_analyzer3 ( ) <EOL> EnsureContains ( matched = True , build_targets = { '<STR_LIT:a>' , '<STR_LIT:b>' } ) <EOL> _CreateConfigFile ( [ '<STR_LIT>' , '<STR_LIT>' ] , [ ] ) <EOL> run_analyzer3 ( ) <EOL> EnsureContains ( matched = True , build_targets = { '<STR_LIT:a>' , '<STR_LIT:b>' , '<STR_LIT:c>' , '<STR_LIT:e>' } ) <EOL> _CreateConfigFile ( [ '<STR_LIT>' ] , [ '<STR_LIT:a>' ] ) <EOL> run_analyzer3 ( ) <EOL> EnsureContains ( matched = True , targets = { '<STR_LIT:a>' } , build_targets = { '<STR_LIT:a>' , '<STR_LIT:b>' } ) <EOL> _CreateConfigFile ( [ '<STR_LIT>' ] , [ '<STR_LIT:a>' , '<STR_LIT:b>' ] ) <EOL> run_analyzer3 ( ) <EOL> EnsureContains ( matched = True , targets = { '<STR_LIT:a>' } , build_targets = { '<STR_LIT:a>' } ) <EOL> _CreateConfigFile ( [ '<STR_LIT>' ] , [ '<STR_LIT:a>' , '<STR_LIT:b>' ] ) <EOL> run_analyzer3 ( ) <EOL> EnsureContains ( matched = True , targets = { '<STR_LIT:a>' } , build_targets = { '<STR_LIT:a>' } ) <EOL> _CreateConfigFile ( [ '<STR_LIT>' ] , [ '<STR_LIT:a>' , '<STR_LIT:b>' ] ) <EOL> run_analyzer3 ( ) <EOL> EnsureContains ( matched = True , targets = { '<STR_LIT:a>' , '<STR_LIT:b>' } , build_targets = { '<STR_LIT:a>' , '<STR_LIT:b>' } ) <EOL> _CreateConfigFile ( [ '<STR_LIT>' ] , [ '<STR_LIT:a>' ] ) <EOL> run_analyzer3 ( ) <EOL> EnsureContains ( matched = True , targets = { '<STR_LIT:a>' } , build_targets = { '<STR_LIT:a>' , '<STR_LIT:b>' } ) <EOL> _CreateConfigFile ( [ '<STR_LIT>' ] , [ '<STR_LIT:a>' ] ) <EOL> run_analyzer3 ( ) <EOL> EnsureContains ( matched = True , targets = { '<STR_LIT:a>' } , build_targets = { '<STR_LIT:a>' } ) <EOL> _CreateConfigFile ( [ '<STR_LIT>' ] , [ ] ) <EOL> run_analyzer3 ( ) <EOL> EnsureContains ( matched = True , build_targets = { '<STR_LIT:a>' } ) <EOL> _CreateConfigFile ( [ '<STR_LIT>' ] , [ ] ) <EOL> run_analyzer3 ( ) <EOL> EnsureContains ( matched = True , build_targets = { '<STR_LIT:a>' , '<STR_LIT:b>' } ) <EOL> _CreateConfigFile ( [ '<STR_LIT>' ] , [ ] ) <EOL> run_analyzer4 ( ) <EOL> EnsureContains ( matched = True , build_targets = { '<STR_LIT:e>' , '<STR_LIT:f>' } ) <EOL> _CreateConfigFile ( [ '<STR_LIT>' ] , [ ] ) <EOL> run_analyzer4 ( ) <EOL> EnsureContains ( matched = True , build_targets = { '<STR_LIT:a>' , '<STR_LIT:b>' , '<STR_LIT:c>' , '<STR_LIT:d>' } ) <EOL> _CreateConfigFile ( [ '<STR_LIT>' ] , [ ] ) <EOL> run_analyzer4 ( ) <EOL> EnsureContains ( matched = True , build_targets = { '<STR_LIT:h>' } ) <EOL> test . pass_test ( ) </s>
