funit-12 0.12.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,111 @@
1
+ require 'test/unit'
2
+ require 'funit/testsuite'
3
+
4
+ require 'fileutils'
5
+ include FileUtils
6
+
7
+ class TestTestSuite < Test::Unit::TestCase
8
+
9
+ def setup
10
+ files = *Dir["dummyf90test*"]
11
+ rm_f files if files
12
+ end
13
+
14
+ def teardown
15
+ files = *Dir["dummyf90test*"]
16
+ rm_f files if files
17
+ end
18
+
19
+ def test_nonexistent_funit_file_is_not_created
20
+ Funit::TestSuite.new 'dummyf90test', '', false
21
+ assert !File.exists?("dummyf90test.fun")
22
+ assert !File.exists?("dummyf90test_fun.f90")
23
+ end
24
+
25
+ def create_funit_file funit_contents
26
+ File.open('dummyf90test.f90','w') do |f|
27
+ f.puts "module dummyf90test\nend module dummyf90test"
28
+ end
29
+ File.open('dummyf90test.fun','w') do |f|
30
+ f.puts funit_contents
31
+ end
32
+ end
33
+
34
+ @@compileCommand = "#{ENV['FC']} -c dummyf90test.f90 dummyf90test_fun.f90"
35
+
36
+ def test_bare_minimum_funit_file_compiles
37
+ create_funit_file ""
38
+ Funit::TestSuite.new 'dummyf90test', '', false
39
+ assert system(@@compileCommand)
40
+ end
41
+
42
+ def test_module_variables_allowed
43
+ create_funit_file "integer :: a"
44
+ Funit::TestSuite.new 'dummyf90test', '', false
45
+ assert system(@@compileCommand)
46
+ end
47
+
48
+ def test_blank_setup_compiles
49
+ create_funit_file "beginSetup\nendSetup"
50
+ Funit::TestSuite.new 'dummyf90test', '', false
51
+ assert system(@@compileCommand)
52
+ end
53
+
54
+ def test_blank_test_gives_warning
55
+ create_funit_file "beginTest bob\nendTest"
56
+ Funit::TestSuite.new 'dummyf90test', '', false
57
+ assert system(@@compileCommand)
58
+ end
59
+
60
+ def test_single_assert_test_compiles
61
+ create_funit_file "beginTest assertTrue\nAssertTrue(.true.)\nendTest"
62
+ Funit::TestSuite.new 'dummyf90test', '', false
63
+ assert system(@@compileCommand)
64
+ end
65
+
66
+ def test_matrix_assert_compiles
67
+ create_funit_file <<-MATRIX
68
+ beginTest assertTrue
69
+ integer :: a(2,2)
70
+ a = 1
71
+ AssertEqual(1,a(1,1))
72
+ endTest
73
+ MATRIX
74
+ Funit::TestSuite.new 'dummyf90test', '', false
75
+ assert system(@@compileCommand)
76
+ end
77
+
78
+ def test_simple_real_equals_assert_works
79
+ create_funit_file <<-REALEQUALS
80
+ beginTest assert_equals
81
+ real :: real_var
82
+ real_var = 1.0
83
+ AssertRealEqual(1.0,real_var)
84
+ endTest
85
+ REALEQUALS
86
+ Funit::TestSuite.new 'dummyf90test', '', false
87
+ assert system(@@compileCommand)
88
+ end
89
+
90
+ def test_real_equals_assert_works_with_function
91
+ create_funit_file <<-REQUALSFUNC
92
+ beginTest assert_equals_for_function
93
+ AssertRealEqual(0.0,balance(0.0,0.0))
94
+ endTest
95
+ function balance( left, right)
96
+ real :: balance
97
+ real, intent(in) :: left, right
98
+ balance = 0.5*(left+right)
99
+ end function balance
100
+ REQUALSFUNC
101
+ Funit::TestSuite.new 'dummyf90test', '', false
102
+ assert system(@@compileCommand)
103
+ end
104
+
105
+ def test_ignore_commented_test
106
+ create_funit_file "XbeginTest bob\nendTest"
107
+ Funit::TestSuite.new 'dummyf90test', '', false
108
+ assert_no_match( /Testbob/i, IO.readlines('dummyf90test_fun.f90').join )
109
+ end
110
+
111
+ end
@@ -0,0 +1,88 @@
1
+ From - Mon Nov 12 23:36:17 2001
2
+ Path: reznor.larc.nasa.gov!kant.larc.nasa.gov!logbridge.uoregon.edu!news-peer.gip.net!news.gsl.net!gip.net!newsfeed.mathworks.com!cyclone.swbell.net!easynews!sjc-peer.news.verio.net!news.verio.net!sea-read.news.verio.net.POSTED!not-for-mail
3
+ Sender: mikesl@thneed.na.wrq.com
4
+ Newsgroups: comp.emacs
5
+ Subject: Re: Re-centering buffer based on error line indicted in another buffer
6
+ References: <3BF03829.826F39CB@LaRC.NASA.Gov>
7
+ From: Michael Slass <mikesl@wrq.com>
8
+ Message-ID: <m3wv0vipqe.fsf@thneed.na.wrq.com>
9
+ Lines: 68
10
+ User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.1
11
+ MIME-Version: 1.0
12
+ Content-Type: text/plain; charset=us-ascii
13
+ Date: Mon, 12 Nov 2001 22:33:35 GMT
14
+ NNTP-Posting-Host: 150.215.90.102
15
+ X-Complaints-To: abuse@verio.net
16
+ X-Trace: sea-read.news.verio.net 1005604415 150.215.90.102 (Mon, 12 Nov 2001 22:33:35 GMT)
17
+ NNTP-Posting-Date: Mon, 12 Nov 2001 22:33:35 GMT
18
+ Organization: Verio
19
+ Xref: reznor.larc.nasa.gov comp.emacs:70829
20
+
21
+ Bil Kleb <W.L.Kleb@LaRC.NASA.Gov> writes:
22
+
23
+ >So, I have a mode that executes a command on the
24
+ >current buffer, and displays the resulting output
25
+ >in another buffer (with possibly some error messages
26
+ >which include line numbers in the original buffer).
27
+ >
28
+ >What I would like to have now is a function which
29
+ >scans the output buffer for errors (doing a regex
30
+ >pattern match?), and recenters the original buffer
31
+ >on the first error line indicated by the output buffer.
32
+ >(Auctex mode has a similar feature, but the code
33
+ >is much too involved for this newbie lisp brain to
34
+ >effectively decipher.)
35
+ >
36
+ >Any suggestions on references to search, keywords to
37
+ >use during a search, etc.?
38
+ >
39
+ >TIA,
40
+ >--
41
+ >bil <http://abweb.larc.nasa.gov/~kleb/>
42
+
43
+ Here's a quick kludge for this, if you don't want to try to adapt
44
+ compilation mode. It's kludgey, but if you're lucky, some of the gurus
45
+ will give you (and me) pointers on how to make it less so.
46
+
47
+
48
+ (defvar bk-error-buffer
49
+ "*error-buffer*"
50
+ "Buffer name for error messages used by `bk-next-error'")
51
+
52
+ (defvar bk-error-message-regexp
53
+ "error at line \\([0-9]+\\)"
54
+ "Regular expression used by `bk-next-error' to find error messages.
55
+ The sub-expression between the first capturing parens must be the line
56
+ number where the error occured")
57
+
58
+
59
+ (defun bk-next-error ()
60
+ "Goto line in current buffer indicated by next error message in `bk-error-buffer'
61
+
62
+ Assumes that the point is positioned before the first occurance of
63
+ `bk-error-message-regexp' in the `bk-error-buffer' before the first
64
+ call to this function.
65
+
66
+ See also `bk-error-message-regexp' `bk-error-buffer'"
67
+
68
+ (interactive)
69
+ (let ((error-line-number))
70
+ (save-current-buffer
71
+ (set-buffer (or (get-buffer bk-error-buffer)
72
+ (error
73
+ (concat
74
+ "Can't find the error buffer: "
75
+ bk-error-buffer))))
76
+ (if (re-search-forward bk-error-message-regexp nil t)
77
+ (progn
78
+ (setq error-line-number
79
+ (string-to-number
80
+ (buffer-substring (match-beginning 1)
81
+ (match-end 1))))
82
+ (goto-char (1+ (match-end 1))))))
83
+ (if error-line-number
84
+ (goto-line error-line-number)
85
+ (message "No more errors"))))
86
+
87
+ --
88
+ Mike
@@ -0,0 +1,22 @@
1
+ ;; Make a generic-mode for fUnit files:
2
+ (require 'generic)
3
+ (define-generic-mode 'funit-generic-mode
4
+ (list ?!)
5
+ (list
6
+ "test_suite"
7
+ "end test_suite"
8
+ "test"
9
+ "end test"
10
+ "setup"
11
+ "end setup"
12
+ "teardown"
13
+ "end teardown"
14
+ )
15
+ '(("\\(Assert_False\\)" 1 'font-lock-function-name-face)
16
+ ("\\(Assert_True\\)" 1 'font-lock-function-name-face)
17
+ ("\\(Assert_Equal_Within\\)" 1 'font-lock-function-name-face)
18
+ ("\\(Assert_Equal\\)" 1 'font-lock-function-name-face)
19
+ ("\\(Assert_Real_Equal\\)" 1 'font-lock-function-name-face))
20
+ (list "\\.fun\\'")
21
+ nil
22
+ "Generic mode for fUnit files.")
@@ -0,0 +1,113 @@
1
+ ;; 'funit-mode.el' - a derived major mode for editing fUnit files
2
+ ;;
3
+ ;; INSTALLATION:
4
+ ;;
5
+ ;; 1) Copy 'funit-mode.el' to the system site-lisp directory, e.g.,
6
+ ;;
7
+ ;; /usr/share/emacs/site-lisp
8
+ ;;
9
+ ;; or, if you do not have root permission, somewhere local
10
+ ;; and set the load-path search variable in your ~/.emacs file
11
+ ;; accordingly, e.g.,
12
+ ;;
13
+ ;; (setq load-path (append load-path '("~/lisp")))
14
+ ;;
15
+ ;; 2) To automatically activate funit-mode when visiting files,
16
+ ;; add the following lines to your ~/.emacs file:
17
+ ;;
18
+ ;; (autoload 'funit-mode "funit-mode"
19
+ ;; "Mode for editing fUnit files.")
20
+ ;; (setq auto-mode-alist
21
+ ;; (cons '("\\.fun$" . funit-mode) auto-mode-alist))
22
+
23
+ (define-derived-mode funit-mode
24
+ f90-mode "fUnit"
25
+ "Major mode for fUnit files (derived from F90 mode).\n\n
26
+ \\{funit-mode-map}"
27
+ (interactive)
28
+ (message "fUnit mode.")
29
+ )
30
+
31
+ ;; add some new font-locks to f90's extensive list
32
+ (font-lock-add-keywords 'funit-mode
33
+ '(("\\<Assert_False\\>" . font-lock-function-name-face)
34
+ ("\\<Assert_Equal\\>" . font-lock-function-name-face)
35
+ ("\\<Assert_Real_Equal\\>" . font-lock-function-name-face)
36
+ ("\\<Assert_True\\>" . font-lock-function-name-face)
37
+ ("\\<Assert_Equal_Within\\>" . font-lock-function-name-face)
38
+ ("\\<test_suite\\>" . font-lock-builtin-face)
39
+ ("\\<end test_suite\\>" . font-lock-builtin-face)
40
+ ("\\<test\\>" . font-lock-builtin-face)
41
+ ("\\<end test\\>" . font-lock-builtin-face)
42
+ ("\\<teardown\\>" . font-lock-builtin-face)
43
+ ("\\<end teardown\\>" . font-lock-builtin-face)
44
+ ("\\<setup\\>" . font-lock-builtin-face)
45
+ ("\\<end setup\\>" . font-lock-builtin-face))
46
+ )
47
+
48
+ (defvar funit-buffer-command "funit"
49
+ "Shell command used by the \\[funit-test-buffer] function.")
50
+
51
+ ;;(defvar compilation-buffer-name-function "* fUnit output *")
52
+
53
+ ;; run fUnit on the current buffer:
54
+ (defun funit-test-buffer ()
55
+ "Excute \\[funit-buffer-command] on the file associated
56
+ with the current buffer."
57
+ (interactive)
58
+ ; (compile funit-buffer-command);; (file-name-nondirectory buffer-file-name)))
59
+ (save-buffer)
60
+ (shell-command-on-region (point-min) (point-max) funit-buffer-command funit-error-buffer)
61
+ )
62
+
63
+ ;; key-binding for running fUnit on the current buffer
64
+ (define-key funit-mode-map "\C-c\C-c" 'funit-test-buffer)
65
+
66
+ ;; add fUnit error regex to compilation mode:
67
+ ;; blah, blah, blak [FluxFunctions.fun:34]
68
+ ;(require 'compile)
69
+ ;(setq compilation-error-regexp-alist
70
+ ; (cons '("\\[\\(.+\\):\\([0-9]+\\)\\]" 1 2) compilation-error-regexp-alist)
71
+ ;)
72
+
73
+ (defvar funit-error-buffer
74
+ "*fUnit output-buffer*"
75
+ "Buffer name for error messages used by `funit-next-error'")
76
+
77
+ (defvar funit-error-message-regexp
78
+ "\\[.+:\\([0-9]+\\)\\]"
79
+ "Regular expression used by `funit-next-error' to find error messages.
80
+ The sub-expression between the first capturing parens must be the line
81
+ number where the error occured")
82
+
83
+ (defun funit-next-error ()
84
+ "Goto line in current buffer indicated by next error message in `funit-error-buffer'
85
+
86
+ Assumes that the point is positioned before the first occurance of
87
+ `funit-error-message-regexp' in the `funit-error-buffer' before the first
88
+ call to this function.
89
+
90
+ See also `funit-error-message-regexp' `funit-error-buffer'"
91
+
92
+ (interactive)
93
+ (let ((error-line-number))
94
+ (save-current-buffer
95
+ (set-buffer (or (get-buffer funit-error-buffer)
96
+ (error
97
+ (concat
98
+ "Can't find the error buffer: "
99
+ funit-error-buffer))))
100
+ (if (re-search-forward funit-error-message-regexp nil t)
101
+ (progn
102
+ (setq error-line-number
103
+ (string-to-number
104
+ (buffer-substring (match-beginning 1)
105
+ (match-end 1))))
106
+ (goto-char (1+ (match-end 1))))))
107
+ (if error-line-number
108
+ (goto-line error-line-number)
109
+ (message "No more errors"))))
110
+
111
+ (provide 'funit-mode)
112
+
113
+ ;; end of 'funit-mode.el'
metadata ADDED
@@ -0,0 +1,118 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: funit-12
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.12.1
5
+ platform: ruby
6
+ authors:
7
+ - Karen Bibb
8
+ - Bil Kleb
9
+ - Beth Lee-Rausch
10
+ - Mike Park
11
+ - Bill Wood
12
+ - Kyle Thompson
13
+ autorequire:
14
+ bindir: bin
15
+ cert_chain: []
16
+ date: 2016-01-19 00:00:00.000000000 Z
17
+ dependencies:
18
+ - !ruby/object:Gem::Dependency
19
+ name: fortran_dependencies
20
+ requirement: !ruby/object:Gem::Requirement
21
+ requirements:
22
+ - - '>='
23
+ - !ruby/object:Gem::Version
24
+ version: 1.1.0
25
+ type: :runtime
26
+ prerelease: false
27
+ version_requirements: !ruby/object:Gem::Requirement
28
+ requirements:
29
+ - - '>='
30
+ - !ruby/object:Gem::Version
31
+ version: 1.1.0
32
+ - !ruby/object:Gem::Dependency
33
+ name: hoe
34
+ requirement: !ruby/object:Gem::Requirement
35
+ requirements:
36
+ - - '>='
37
+ - !ruby/object:Gem::Version
38
+ version: 2.3.3
39
+ type: :development
40
+ prerelease: false
41
+ version_requirements: !ruby/object:Gem::Requirement
42
+ requirements:
43
+ - - '>='
44
+ - !ruby/object:Gem::Version
45
+ version: 2.3.3
46
+ description: 'FUnit is a unit testing framework for Fortran. Unit tests are written
47
+ as Fortran fragments that use a small set of testing-specific keywords and functions. FUnit
48
+ transforms these fragments into valid Fortran code, compiles, links, and runs them
49
+ against the code under test. FUnit is {opinionated software}[http://www.oreillynet.com/pub/a/network/2005/08/30/ruby-rails-david-heinemeier-hansson.html],
50
+ which values convention over configuration. Specifically, FUnit requires, * a Fortran
51
+ 95 compiler, * tests to be stored along side the code under test, and * test files
52
+ to be named appropriately. (Note: this has been forked from the original funit gem,
53
+ due to issues with access to original gem)'
54
+ email: nasarb-developers@rubyforge.org
55
+ executables:
56
+ - funit-12
57
+ extensions: []
58
+ extra_rdoc_files:
59
+ - History.txt
60
+ - License.txt
61
+ - Manifest.txt
62
+ - README.txt
63
+ files:
64
+ - History.txt
65
+ - License.txt
66
+ - Manifest.txt
67
+ - README.txt
68
+ - bin/funit-12
69
+ - examples/CFD/FluxFunctions.f90
70
+ - examples/CFD/FluxFunctions.fun
71
+ - examples/CFD/Gammas.f90
72
+ - examples/CFD/GasModel.f90
73
+ - examples/CFD/GasModel.fun
74
+ - examples/ReadData/time_series_data.f90
75
+ - examples/ReadData/time_series_data.fun
76
+ - examples/StopWatch/StopWatch.f90
77
+ - examples/StopWatch/StopWatch.fun
78
+ - lib/funit.rb
79
+ - lib/funit/assertions.rb
80
+ - lib/funit/c_tools.rb
81
+ - lib/funit/compiler.rb
82
+ - lib/funit/functions.rb
83
+ - lib/funit/testsuite.rb
84
+ - pitch/slides.tex
85
+ - test/test_compiler.rb
86
+ - test/test_functions.rb
87
+ - test/test_funit.rb
88
+ - test/test_testsuite.rb
89
+ - utils/errorFinder.el
90
+ - utils/funit-generic-mode.el
91
+ - utils/funit-mode.el
92
+ homepage: http://rubyforge.org/projects/nasarb
93
+ licenses: []
94
+ metadata: {}
95
+ post_install_message:
96
+ rdoc_options:
97
+ - --main
98
+ - README.txt
99
+ require_paths:
100
+ - lib
101
+ required_ruby_version: !ruby/object:Gem::Requirement
102
+ requirements:
103
+ - - '>='
104
+ - !ruby/object:Gem::Version
105
+ version: '0'
106
+ required_rubygems_version: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - '>='
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ requirements:
112
+ - A Fortran compiler.
113
+ rubyforge_project: nasarb
114
+ rubygems_version: 2.4.8
115
+ signing_key:
116
+ specification_version: 2
117
+ summary: FUnit is a unit testing framework for Fortran
118
+ test_files: []