2017-02-25 5 views
1

私はEliomを使用して新しいプロジェクトを構築しており、OUnitを使用した単体テストのコンパイルプロセスの設定には問題があります。私はocsigenserverを使用せずにJs_Client_Code.eliomにユニットテストを実行できるように、私はこの方法でファイルを設定しているEliomフレームワークの単体テスト

Js_Client_Code.eliom - contains all of the client side code 
Project.eliom - contains all of the server side code (including opening Js_Client_Code.eliom) 

私は2つのファイルを持っています。

これは、テストのために私の現在のmakefileです:シェルでmake testを実行

test: prep unit_tests  

prep: 
    eliomc -infer Js_Client_Code.eliom 
    js_of_eliom -linkall -a Js_Client_Code.eliom -o file_a.cma 
    eliomc -a -linkall Js_Client_Code.eliom -o file_b.cma 

# Code is here to move the cma files back to the parent directory, since they are written to _client/ and _server/ by default 

unit_tests: 
    ocamlfind ocamlc -thread -syntax camlp4o -package ounit,js_of_ocaml.syntax \ 
    -linkpkg -g -o UnitTests file_a.cma file_b.cma unit_tests.ml 

File "unit_tests.ml", line 1: 
Error: Error while linking file_a.cma(Js_Client_Code): 
Reference to undefined global `Eliom_client' 

私はEliom/Js_of_ocamlコンパイルプロセスを誤解、あるいは単にこのことについて間違って行くアムを生成方法?

答えて

0

あなたはeliomライブラリをまったくリンクしていないので、すべての外部モジュールが欠落しています。

正直なところ、エリオムに依存する単体テストモジュールを管理するつもりはないと思います。おそらく非エロイム部分を個別にテストし、エンドツーエンドのブラウザベースのテストを行うほうが簡単でしょう(そのためのフレームワークはたくさんあります)。

実際に試してみたい場合は、静的にリンクするeliom(またはocsigenserver)のマニュアルについて説明しています。