Skip to content

Commit

Permalink
added tests
Browse files Browse the repository at this point in the history
  • Loading branch information
vladima committed Jul 1, 2015
1 parent 1d8dd07 commit 326a7fc
Show file tree
Hide file tree
Showing 6 changed files with 67 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/absil/ilread.fs
Original file line number Diff line number Diff line change
Expand Up @@ -1537,7 +1537,9 @@ let readStringHeapOption ctxt idx = if idx = 0 then None else Some (readString
let emptyByteArray: byte[] = [||]
let readBlobHeapUncached ctxtH idx =
let ctxt = getHole ctxtH
if idx < 0 || idx >= ctxt.blobsStreamSize then emptyByteArray
// valid index lies in range [1..streamSize)
// NOTE: idx cannot be 0 - Blob\String heap has first empty element that is one byte 0
if idx <= 0 || idx >= ctxt.blobsStreamSize then emptyByteArray
else seekReadBlob ctxt.is (ctxt.blobsStreamPhysicalLoc + idx)
let readBlobHeap ctxt idx = ctxt.readBlobHeap idx
let readBlobHeapOption ctxt idx = if idx = 0 then None else Some (readBlobHeap ctxt idx)
Expand Down
Binary file added tests/fsharp/core/ilread/Library.dll
Binary file not shown.
35 changes: 35 additions & 0 deletions tests/fsharp/core/ilread/build.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
@if "%_echo%"=="" echo off

setlocal
REM Configure the sample, i.e. where to find the F# compiler and C# compiler.
if EXIST build.ok DEL /f /q build.ok

call %~d0%~p0..\..\..\config.bat
@if ERRORLEVEL 1 goto Error

if NOT "%FSC:NOTAVAIL=X%" == "%FSC%" (
REM Skipping test for FSI.EXE
goto Skip
)

"%FSC%" %fsc_flags% /r:Library.dll /out:test.exe test.fs
@if ERRORLEVEL 1 goto Error

"%PEVERIFY%" test.exe
@if ERRORLEVEL 1 goto Error

:Ok
echo Built fsharp %~f0 ok.
echo. > build.ok
endlocal
exit /b 0

:Skip
echo Skipped %~f0
endlocal
exit /b 0


:Error
endlocal
exit /b %ERRORLEVEL%
22 changes: 22 additions & 0 deletions tests/fsharp/core/ilread/run.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
@if "%_echo%"=="" echo off

setlocal
dir build.ok > NUL ) || (
@echo 'build.ok' not found.
goto :ERROR
)

call %~d0%~p0..\..\..\config.bat

%CLIX% .\test.exe
if ERRORLEVEL 1 goto Error

:Ok
echo Ran fsharp %~f0 ok.
endlocal
exit /b 0

:Error
endlocal
exit /b %ERRORLEVEL%

6 changes: 6 additions & 0 deletions tests/fsharp/core/ilread/test.fs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
open Library

let main _ =
let cls = Class1()
let len = cls.GetLength("123")
if len = 3 then 0 else 1
1 change: 1 addition & 0 deletions tests/test.lst
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ Core03 fsharp\core\innerpoly
Core03 fsharp\core\int32
Core03 fsharp\core\internalsvisible
Core03 fsharp\core\interop
Core03 fsharp\core\ilread
Core03 fsharp\core\lazy
Core03 fsharp\core\letrec
Core03,Smoke fsharp\core\libtest
Expand Down

0 comments on commit 326a7fc

Please sign in to comment.