From: Bil Kleb Date: 2006-10-11T23:30:08+09:00 Subject: Re: scanning strings, backward? Bil Kleb wrote: > > So, the tasks are roughly, I should have just posted a test? Warning: untested test ;) require 'import_cleaner' require 'test/unit' def class TestImportCleaner < Test::Unit::TestCase def test_simple_case compiler_output =<<-EOS Warning: code.f90, line 8: DT explicitly imported into SAY_TIME but not used detected at SAY_TIME@ EOS fortran_code =<<-EOC subroutine print_dt use timestep, only: dt print*, dt end subroutine say_time use timestep, only: dt, time print *, 'Time: ', time end EOC clean_code = fortran_code.clean_imports(compiler_output) assert_match /only: time$/, clean_code, 'did not remove extraneous import' assert_match /only: dt$/, clean_code, 'removed wrong import' assert_match /print\*, dt/, clean_code, 'modified other code' end end Regards, -- Bil Kleb http://fun3d.larc.nasa.gov