Skip to content

Commit 78f0dcc

Browse files
Yuki-NagoriJimZhouZZY
authored andcommitted
!330 [200_2] 重新支持C++测试和Scheme测试的运行
* tests功能恢复
1 parent 8dc4097 commit 78f0dcc

File tree

20 files changed

+1131
-334
lines changed

20 files changed

+1131
-334
lines changed

.github/workflows/cd_research_on_macos.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ jobs:
3636
run: |
3737
xmake install -vD research_packager
3838
- name: Upload
39-
uses: actions/upload-artifact@v3
39+
uses: actions/upload-artifact@v4
4040
if: ${{ !startsWith(github.ref, 'refs/tags/') }}
4141
with:
4242
path: build/MoganResearch-*.dmg

.github/workflows/ci-macos-arm64.yml

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,17 +68,27 @@ jobs:
6868
uses: actions/cache@v3
6969
with:
7070
path: |
71-
${{ env.XMAKE_GLOBALDIR }}/.xmake/packages
72-
key: xrepo-${{ runner.os }}-${{ matrix.arch }}-${{ hashFiles('xmake-requires.lock') }}
71+
${{ env.XMAKE_GLOBALDIR }}/.xmake/packages
72+
key: ${{ runner.os }}-xrepo-qt${{ matrix.qt_ver }}-${{ hashFiles('**/packages.lua') }}
7373

7474
- name: cache xmake
7575
uses: actions/cache@v3
7676
with:
7777
path: |
7878
${{ runner.workspace }}/build/.build_cache
79-
key: xmake-build-${{ runner.os }}-${{ matrix.arch }}-${{ hashFiles('xmake-requires.lock') }}
79+
key: ${{ runner.os }}-build-qt${{ matrix.qt_ver }}-${{ hashFiles('**/packages.lua') }}
8080

8181
- name: config
8282
run: xmake config --policies=build.ccache -o ${{ runner.workspace }}/build -m releasedbg -a ${{ matrix.arch }} --yes
8383
- name: build
8484
run: xmake build --yes -vD research && xmake build --yes -vD --group=tests
85+
- name: C++ tests
86+
run: xmake run --yes --verbose --diagnosis --group=tests
87+
env:
88+
QT_QPA_PLATFORM: offscreen
89+
- name: Scheme tests
90+
run: xmake run --yes -vD --group=scheme_tests
91+
- name: integration test
92+
run: xmake run --yes -vD --group=integration_tests
93+
env:
94+
QT_QPA_PLATFORM: offscreen

.github/workflows/ci-xmake-macos.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,15 +70,15 @@ jobs:
7070
uses: actions/cache@v3
7171
with:
7272
path: |
73-
${{ env.XMAKE_GLOBALDIR }}/.xmake/packages
74-
key: xrepo-${{ runner.os }}-${{ matrix.arch }}-${{ hashFiles('xmake-requires.lock') }}
73+
${{ env.XMAKE_GLOBALDIR }}/.xmake/packages
74+
key: ${{ runner.os }}-xrepo-qt${{ matrix.qt_ver }}-${{ hashFiles('**/packages.lua') }}
7575

7676
- name: cache xmake
7777
uses: actions/cache@v3
7878
with:
7979
path: |
8080
${{ runner.workspace }}/build/.build_cache
81-
key: xmake-build-${{ runner.os }}-${{ matrix.arch }}-${{ hashFiles('xmake-requires.lock') }}
81+
key: ${{ runner.os }}-build-qt${{ matrix.qt_ver }}-${{ hashFiles('**/packages.lua') }}
8282

8383
- name: config
8484
run: xmake config --policies=build.ccache -o ${{ runner.workspace }}/build -m releasedbg --yes

TeXmacs/progs/kernel/gui/menu-demo.scm

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -263,3 +263,63 @@
263263
(tm-define (show-form w)
264264
;; Example: execute (show-form form1) in a Scheme session
265265
(dialogue-window w (lambda (x) (display* x "\n")) "Simple form"))
266+
267+
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
268+
;; Regtest routines for menu widgets
269+
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
270+
271+
(define (regtest-menu-widgets)
272+
;; Basic test to ensure menu module loads without errors
273+
(regression-test-group
274+
"menu" "widgets"
275+
values values
276+
(test "module loaded successfully"
277+
#t
278+
#t)
279+
(test "tm-widget macro available"
280+
(defined? 'tm-widget)
281+
#t)
282+
(test "show function available"
283+
(defined? 'show)
284+
#t)
285+
(test "show-form function available"
286+
(defined? 'show-form)
287+
#t)
288+
(test "tm-define macro available"
289+
(defined? 'tm-define)
290+
#t)
291+
(test "menu-bind macro available"
292+
(defined? 'menu-bind)
293+
#t)
294+
(test "display* function available"
295+
(defined? 'display*)
296+
#t)
297+
(test "noop function available"
298+
(defined? 'noop)
299+
#t)
300+
(test "refresh-now function available"
301+
(defined? 'refresh-now)
302+
#t)
303+
(test "stree->tree function available"
304+
(defined? 'stree->tree)
305+
#t)
306+
(test "buffer-tree function available"
307+
(defined? 'buffer-tree)
308+
#t)
309+
(test "widget-hmenu function available"
310+
(defined? 'widget-hmenu)
311+
#t)
312+
(test "widget-text function available"
313+
(defined? 'widget-text)
314+
#t)
315+
(test "widget-vlist function available"
316+
(defined? 'widget-vlist)
317+
#t)
318+
(test "widget-hlist function available"
319+
(defined? 'widget-hlist)
320+
#t)))
321+
322+
(tm-define (regtest-menu)
323+
(let ((n (regtest-menu-widgets)))
324+
(display* "Total: " (number->string n) " tests.\n")
325+
(display "Test suite of regtest-menu: ok\n")))

TeXmacs/progs/kernel/old-gui/old-gui-demo.scm

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,3 +226,60 @@
226226
>>>
227227
(form-cancel)
228228
(form-done "Save" ignore)))))
229+
230+
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
231+
;; Regtest routines for old-gui widgets
232+
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
233+
234+
(define (regtest-old-gui-widgets)
235+
;; Basic test to ensure old-gui module loads without errors
236+
(regression-test-group
237+
"old-gui" "widgets"
238+
values values
239+
(test "module loaded successfully"
240+
#t
241+
#t)
242+
(test "tm-build-widget macro available"
243+
(defined? 'tm-build-widget)
244+
#t)
245+
(test "widget-popup function available"
246+
(defined? 'widget-popup)
247+
#t)
248+
(test "widget-ref function available"
249+
(defined? 'widget-ref)
250+
#t)
251+
(test "widget-set! function available"
252+
(defined? 'widget-set!)
253+
#t)
254+
(test "widget-delayed function available"
255+
(defined? 'widget-delayed)
256+
#t)
257+
(test "widget->script function available"
258+
(defined? 'widget->script)
259+
#t)
260+
(test "script->widget function available"
261+
(defined? 'script->widget)
262+
#t)
263+
(test "display* function available"
264+
(defined? 'display*)
265+
#t)
266+
(test "noop function available"
267+
(defined? 'noop)
268+
#t)
269+
(test "tree->string function available"
270+
(defined? 'tree->string)
271+
#t)
272+
(test "string-append function available"
273+
(defined? 'string-append)
274+
#t)
275+
(test "list function available"
276+
(defined? 'list)
277+
#t)
278+
(test "concat function available"
279+
(defined? 'concat)
280+
#t)))
281+
282+
(tm-define (regtest-old-gui)
283+
(let ((n (regtest-old-gui-widgets)))
284+
(display* "Total: " (number->string n) " tests.\n")
285+
(display "Test suite of regtest-old-gui: ok\n")))

TeXmacs/progs/kernel/regexp/regexp-demo.scm

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,63 @@
2525
(:b (:repeat :a)))
2626

2727
;; (match? '(a b c a b c x) '(:b x))
28+
29+
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
30+
;; Regtest routines for regexp
31+
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
32+
33+
(define (regtest-regexp-match)
34+
;; Basic test to ensure regexp module loads without errors
35+
(regression-test-group
36+
"regexp" "match"
37+
values values
38+
(test "module loaded successfully"
39+
#t
40+
#t)
41+
(test "match? function available"
42+
(defined? 'match?)
43+
#t)
44+
(test "define-regexp-grammar macro available"
45+
(defined? 'define-regexp-grammar)
46+
#t)
47+
(test "match function available"
48+
(defined? 'match)
49+
#t)
50+
(test "match-term table available"
51+
(defined? 'match-term)
52+
#t)
53+
(test "bindings-add function available"
54+
(defined? 'bindings-add)
55+
#t)
56+
(test "define-regexp-grammar-decls function available"
57+
(defined? 'define-regexp-grammar-decls)
58+
#t)
59+
(test "display* function available"
60+
(defined? 'display*)
61+
#t)
62+
(test "cons function available"
63+
(defined? 'cons)
64+
#t)
65+
(test "list function available"
66+
(defined? 'list)
67+
#t)
68+
(test "append function available"
69+
(defined? 'append)
70+
#t)
71+
(test "for-each function available"
72+
(defined? 'for-each)
73+
#t)
74+
(test "ahash-set! function available"
75+
(defined? 'ahash-set!)
76+
#t)
77+
(test "ahash-ref function available"
78+
(defined? 'ahash-ref)
79+
#t)
80+
(test "make-ahash-table function available"
81+
(defined? 'make-ahash-table)
82+
#t)))
83+
84+
(tm-define (regtest-regexp)
85+
(let ((n (regtest-regexp-match)))
86+
(display* "Total: " (number->string n) " tests.\n")
87+
(display "Test suite of regtest-regexp: ok\n")))
Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
(use-modules
2+
(data code)
3+
(data java)
4+
(data julia)
5+
(data scala)
6+
(data python))
7+
8+
(define (regtest-code)
9+
(regression-test-group
10+
"cpp file suffix" "cpp format"
11+
format-from-suffix :none
12+
(test "*.cpp" "cpp" "cpp")
13+
(test "*.hh" "hh" "cpp")
14+
(test "*.hpp" "hpp" "cpp")
15+
(test "*.cc" "cc" "cpp")))
16+
17+
(define (regtest-scheme)
18+
(regression-test-group
19+
"scheme file suffix" "scheme format"
20+
format-from-suffix :none
21+
(test "*.scm" "scm" "scheme")))
22+
23+
(define (regtest-scala)
24+
(regression-test-group
25+
"scala file suffix" "scala format"
26+
format-from-suffix :none
27+
(test "*.scala" "scala" "scala")))
28+
29+
(define (regtest-java)
30+
(regression-test-group
31+
"java file suffix" "java format"
32+
format-from-suffix :none
33+
(test "*.java" "java" "java")))
34+
35+
(define (regtest-python)
36+
(regression-test-group
37+
"python file suffix" "python format"
38+
format-from-suffix :none
39+
(test "*.py" "py" "python")))
40+
41+
(define (regtest-format?)
42+
(regression-test-group
43+
"format?" "boolean"
44+
format? :none
45+
(test "python format" "python" #t)
46+
(test "scala format" "scala" #t)
47+
(test "no such format" "no-such-format" #f)))
48+
49+
(define (regtest-format-get-name)
50+
(regression-test-group
51+
"format-get-name" "string"
52+
format-get-name :none
53+
(test "python format" "python" "Python source code")
54+
(test "scala format" "scala" "Scala source code")
55+
(test "no such format" "no-such-format" #f)))
56+
57+
(define (regtest-format-from-suffix)
58+
(regression-test-group
59+
"format-from-suffix" "string"
60+
format-from-suffix :none
61+
(test "scheme format" "scm" "scheme")
62+
(test "python format" "py" "python")
63+
(test "java format" "java" "java")
64+
(test "scala format" "scala" "scala")
65+
(test "julia format" "jl" "julia")
66+
(test "cpp format" "cpp" "cpp")
67+
(test "cpp format" "hpp" "cpp")
68+
(test "cpp format" "cc" "cpp")
69+
(test "cpp format" "hh" "cpp")
70+
(test "texmacs format" "tm" "texmacs")
71+
(test "texmacs format" "ts" "texmacs")
72+
(test "texmacs format" "stm" "stm")
73+
(test "png format" "png" "png")
74+
(test "no such format" "no-such-format" "generic")))
75+
76+
(tm-define (test_70_7)
77+
(let ((n (+ (regtest-code)
78+
(regtest-java)
79+
(regtest-python)
80+
(regtest-scala)
81+
(regtest-scheme)
82+
(regtest-format?)
83+
(regtest-format-get-name)
84+
(regtest-format-from-suffix))))
85+
(display* "Total: " (object->string n) " tests.\n")
86+
(display "Test suite of 70_7: ok\n")))
87+
88+
(tm-define (regtest-tm-convert)
89+
(test_70_7))

TeXmacs/tests/24_15.scm

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,23 +13,29 @@
1313
(import (srfi srfi-78))
1414
(use-modules (data docx))
1515

16-
(define (tm->docx tm-file-url)
16+
(define (tm->docx tm-file-url docx-file-url)
1717
; Step 1: load the tm file
1818
; (display* "load-buffer: " tm-file-url "\n")
1919
(load-buffer tm-file-url)
2020
; (display* "buffer-loaded: " tm-file-url "\n")
2121

22-
; Step 2: Export the buffer to the docx string
23-
(let* ((result (texmacs-tree->docx-string tm-file-url `()))
24-
(result_len (string-length result)))
25-
; (display result)
26-
(> result_len 0)))
22+
; Step 2: Export the buffer to the docx file url
23+
; (display* "export buffer to: " docx-file-url "\n")
24+
(export-buffer-main (current-buffer) docx-file-url "docx" ())
25+
26+
; Check if the docx file exists
27+
(if (url-exists? docx-file-url)
28+
(display* "Export successful: " docx-file-url "\n")
29+
(display* "Export failed: " docx-file-url "\n"))
30+
31+
(url-exists? docx-file-url))
2732

2833
(define (test_24_15)
2934
(when (os-macos?) (exit 0))
3035
(display (url-exists? (system->url "$TEXMACS_PATH/tests/tm/24_15.tm")))
3136
(let* ((tm-url "$TEXMACS_PATH/tests/tm/24_15.tm")
32-
(result (tm->docx tm-url)))
37+
(docx-url "$TEXMACS_PATH/tests/tm/24_15.docx")
38+
(result (tm->docx tm-url docx-url)))
3339
(check result => #t)
3440
(check-report)
3541
(if (check-failed?) (exit -1))))

TeXmacs/tests/tm/24_15.docx

10.6 KB
Binary file not shown.

bin/test_all

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
1+
#!/bin/bash
2+
13
xmake run --yes -vD --group=tests

0 commit comments

Comments
 (0)