2017-02-25 7 views
1

Eliom을 사용하고 OUnit을 사용하여 단위 테스트를위한 컴파일 프로세스를 설정하는 데 문제가있는 새 프로젝트를 빌드 중입니다. 내가 ocsigenserver를 사용하지 않고 Js_Client_Code.eliom에 단위 테스트를 실행할 수 있도록 나는이 방법으로 파일을 설정 한Eliom Framework의 단위 테스트

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) 

:

나는 두 개의 파일이 있습니다.

이 시험에 대한 내 현재 메이크입니다 :

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 

쉘에 make test 실행이

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)의 매뉴얼을 정적으로 링크하는 방법에 대한 설명이 있습니다.