Skip to content

Instantly share code, notes, and snippets.

@j0sh
Last active August 29, 2015 13:57
Show Gist options
  • Select an option

  • Save j0sh/9357001 to your computer and use it in GitHub Desktop.

Select an option

Save j0sh/9357001 to your computer and use it in GitHub Desktop.
F
==============================================================================
Failure: suite:0:test
expected: Invalid_argument("index out of bounds")
but got: Invalid_argument("index out of bounds")
------------------------------------------------------------------------------
Ran: 1 tests in: 0.00 seconds.
FAILED: Cases: 1 Tried: 1 Errors: 0 Failures: 1 Skip: 0 Todo: 0 Timeouts: 0.
open OUnit
let test ctx =
let foo = "a" in
let f () = foo.[1] in
assert_raises (Invalid_argument "index out of bounds") f
let suite = "suite" >::: [
"test">::test;
]
let _ = run_test_tt_main suite
let () =
let foo = "a" in
let a = Invalid_argument ("index out of bounds") in
let b = try ignore(foo.[1]); Invalid_argument "foo"
with exn -> exn in
Printf.printf "%b\n" (a = b)
.data
.globl camlTest2__data_begin
camlTest2__data_begin:
.text
.globl camlTest2__code_begin
camlTest2__code_begin:
.data
.long 0
.globl camlTest2
camlTest2:
.data
.globl camlTest2__1
.long 1276
camlTest2__1:
.ascii "a"
.space 2
.byte 2
.data
.globl camlTest2__2
.long 5372
camlTest2__2:
.ascii "index out of bounds"
.byte 0
.data
.globl camlTest2__3
.long 1276
camlTest2__3:
.ascii "foo"
.byte 0
.data
.globl camlTest2__4
.long 1276
camlTest2__4:
.ascii "%b\12"
.byte 0
.text
.align 16
.globl camlTest2__entry
camlTest2__entry:
.cfi_startproc
subl $12, %esp
.cfi_adjust_cfa_offset 12
.L102:
movl $camlTest2__1, %ebx
movl $24, %eax
call caml_allocN
.L103:
leal 4(%eax), %eax
movl %eax, 4(%esp)
movl $2048, -4(%eax)
movl $caml_exn_Invalid_argument, (%eax)
movl $camlTest2__2, 4(%eax)
call .L101
movl %eax, 0(%esp)
jmp .L100
.L101:
pushl caml_exception_pointer
.cfi_adjust_cfa_offset 8
movl %esp, caml_exception_pointer
movl -4(%ebx), %ecx
shrl $10, %ecx
lea -1(, %ecx, 4), %ecx
movzbl (%ebx, %ecx), %edx
subl %edx, %ecx
cmpl $1, %ecx
jbe .L104
movzbl 1(%ebx), %ebx
lea 1(%ebx, %ebx), %ebx
addl $12, %eax
movl %eax, 8(%esp)
movl $2048, -4(%eax)
movl $caml_exn_Invalid_argument, (%eax)
movl $camlTest2__3, 4(%eax)
popl caml_exception_pointer
addl $4, %esp
.cfi_adjust_cfa_offset -8
.L100:
movl $camlTest2__4, %eax
call camlPrintf__printf_1369
.L105:
movl %eax, 8(%esp)
movl 0(%esp), %eax
pushl %eax
.cfi_adjust_cfa_offset 4
movl 8(%esp), %eax
pushl %eax
.cfi_adjust_cfa_offset 4
movl $caml_equal, %eax
call caml_c_call
.L106:
addl $8, %esp
.cfi_adjust_cfa_offset -8
movl 8(%esp), %ebx
movl (%ebx), %ecx
call *%ecx
.L107:
movl $1, %eax
addl $12, %esp
.cfi_adjust_cfa_offset -12
ret
.cfi_adjust_cfa_offset 12
.L104: call caml_ml_array_bound_error
.cfi_endproc
.type camlTest2__entry,@function
.size camlTest2__entry,.-camlTest2__entry
.data
.text
.globl camlTest2__code_end
camlTest2__code_end:
.data
.globl camlTest2__data_end
camlTest2__data_end:
.long 0
.globl camlTest2__frametable
camlTest2__frametable:
.long 4
.long .L107
.word 16
.word 0
.align 4
.long .L106
.word 24
.word 1
.word 16
.align 4
.long .L105
.word 16
.word 2
.word 0
.word 4
.align 4
.long .L103
.word 16
.word 1
.word 3
.align 4
.section .note.GNU-stack,"",%progbits
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment