Skip to content

Commit

Permalink
Showing 31 changed files with 868 additions and 5 deletions.
3 changes: 1 addition & 2 deletions lib/ruby/truffle/cext/ruby.h
Original file line number Diff line number Diff line change
@@ -41,8 +41,6 @@ VALUE get_rb_eException();
#define rb_cProc get_rb_cProc();
#define rb_eException get_rb_eException();

VALUE rb_define_class(const char*,VALUE);

VALUE get_rb_cObject();
VALUE get_rb_cArray();
VALUE get_rb_cHash();
@@ -109,6 +107,7 @@ VALUE rb_const_get(VALUE object, ID name);

void rb_raise(VALUE exception, const char *format, ...);

VALUE rb_define_class(const char *name, VALUE superclass);
VALUE rb_define_module(const char *name);
VALUE rb_define_module_under(VALUE module, const char *name);

Binary file modified lib/ruby/truffle/cext/ruby.su
Binary file not shown.
61 changes: 61 additions & 0 deletions spec/truffle/tags/optional/capi/array_tags.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
fails:C-API Array function rb_Array returns obj if it is an array
fails:C-API Array function rb_Array tries to convert obj to an array
fails:C-API Array function rb_Array returns obj wrapped in an array if it cannot be converted to an array
fails:C-API Array function rb_ary_new returns an empty array
fails:C-API Array function rb_ary_new2 returns an empty array
fails:C-API Array function rb_ary_new3 returns an array with the passed cardinality and varargs
fails:C-API Array function rb_ary_new_from_args returns an array with the passed cardinality and varargs
fails:C-API Array function rb_ary_new4 returns returns an array with the passed values
fails:C-API Array function rb_ary_push adds an element to the array
fails:C-API Array function rb_ary_pop removes and returns the last element in the array
fails:C-API Array function rb_ary_join joins elements of an array with a string
fails:C-API Array function rb_ary_to_s creates an Array literal representation as a String
fails:C-API Array function rb_ary_reverse reverses the order of elements in the array
fails:C-API Array function rb_ary_reverse returns the original array
fails:C-API Array function rb_ary_entry returns nil when passed an empty array
fails:C-API Array function rb_ary_entry returns elements from the end when passed a negative index
fails:C-API Array function rb_ary_entry returns nil if the index is out of range
fails:C-API Array function rb_ary_clear removes all elements from the array
fails:C-API Array function rb_ary_dup duplicates the array
fails:C-API Array function rb_ary_unshift prepends the element to the array
fails:C-API Array function rb_ary_shift removes and returns the first element
fails:C-API Array function rb_ary_shift returns nil when the array is empty
fails:C-API Array function rb_ary_store overwrites the element at the given position
fails:C-API Array function rb_ary_store writes to elements offset from the end if passed a negative index
fails:C-API Array function rb_ary_store raises on IndexError if the negative index is greater than the length
fails:C-API Array function rb_ary_store enlarges the array as needed
fails:C-API Array function rb_ary_concat concats two arrays
fails:C-API Array function rb_ary_plus adds two arrays together
fails:C-API Array function RARRAY_PTR returns a pointer to a C array of the array's elements
fails:C-API Array function RARRAY_PTR allows assigning to the elements of the C array
fails:C-API Array function RARRAY_LEN returns the size of the array
fails:C-API Array function RARRAY_AREF returns an element from the array
fails:C-API Array function rb_assoc_new returns an array containing the two elements
fails:C-API Array function rb_ary_includes returns true if the array includes the element
fails:C-API Array function rb_ary_includes returns false if the array does not include the element
fails:C-API Array function rb_ary_aref returns the element at the given index
fails:C-API Array function rb_ary_aref returns nil for an out of range index
fails:C-API Array function rb_ary_aref returns a new array where the first argument is the index and the second is the length
fails:C-API Array function rb_ary_aref accepts a range
fails:C-API Array function rb_ary_aref returns nil when the start of a range is out of bounds
fails:C-API Array function rb_ary_aref returns an empty array when the start of a range equals the last element
fails:C-API Array function rb_iterate calls an callback function as a block passed to an method
fails:C-API Array function rb_iterate calls a function with the other function available as a block
fails:C-API Array function rb_iterate calls a function which can yield into the original block
fails:C-API Array function rb_ary_delete removes an element from an array and returns it
fails:C-API Array function rb_ary_delete returns nil if the element is not in the array
fails:C-API Array function rb_mem_clear sets elements of a C array to nil
fails:C-API Array function rb_ary_freeze freezes the object exactly like Kernel#freeze
fails:C-API Array function rb_ary_delete_at removes an element from an array at a positive index
fails:C-API Array function rb_ary_delete_at removes an element from an array at a negative index
fails:C-API Array function rb_ary_delete_at returns nil if the index is out of bounds
fails:C-API Array function rb_ary_delete_at returns nil if the negative index is out of bounds
fails:C-API Array function rb_ary_to_ary with an array returns the given array
fails:C-API Array function rb_ary_to_ary with an object that responds to to_ary calls to_ary on the object
fails:C-API Array function rb_ary_to_ary with an object that responds to to_a returns the original object in an array
fails:C-API Array function rb_ary_to_ary with an object that doesn't respond to to_ary returns the original object in an array
fails:C-API Array function rb_ary_subseq returns a subsequence of the given array
fails:C-API Array function rb_ary_subseq returns an empty array for a subsequence of 0 elements
fails:C-API Array function rb_ary_subseq returns nil if the begin index is out of bound
fails:C-API Array function rb_ary_subseq returns the existing subsequence of the length is out of bounds
fails:C-API Array function rb_ary_subseq returns nil if the size is negative
20 changes: 20 additions & 0 deletions spec/truffle/tags/optional/capi/bignum_tags.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
fails:CApiBignumSpecs rb_big2long converts a Bignum
fails:CApiBignumSpecs rb_big2long raises RangeError if passed Bignum overflow long
fails:CApiBignumSpecs rb_big2ll converts a Bignum
fails:CApiBignumSpecs rb_big2ll raises RangeError if passed Bignum overflow long
fails:CApiBignumSpecs rb_big2ulong converts a Bignum
fails:CApiBignumSpecs rb_big2ulong wraps around if passed a negative bignum
fails:CApiBignumSpecs rb_big2ulong raises RangeError if passed Bignum overflow long
fails:CApiBignumSpecs rb_big2dbl converts a Bignum to a double value
fails:CApiBignumSpecs rb_big2dbl returns Infinity if the number is too big for a double
fails:CApiBignumSpecs rb_big2dbl returns -Infinity if the number is negative and too big for a double
fails:CApiBignumSpecs rb_big2str converts a Bignum to a string with base 10
fails:CApiBignumSpecs rb_big2str converts a Bignum to a string with a different base
fails:CApiBignumSpecs rb_big_cmp compares a Bignum with a Bignum
fails:CApiBignumSpecs rb_big_cmp compares a Bignum with a Fixnum
fails:CApiBignumSpecs rb_big_pack packs a Bignum into a Fixnum
fails:CApiBignumSpecs rb_dbl2big returns a Fixnum for a Fixnum input value
fails:CApiBignumSpecs rb_dbl2big returns a Fixnum for a Float input value
fails:CApiBignumSpecs rb_dbl2big returns a Bignum for a large enough Float input value
fails:CApiBignumSpecs rb_dbl2big raises FloatDomainError for Infinity values
fails:CApiBignumSpecs rb_dbl2big raises FloatDomainError for NaN values
54 changes: 54 additions & 0 deletions spec/truffle/tags/optional/capi/class_tags.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
fails:C-API Class function rb_class_new_instance allocates and initializes a new object
fails:C-API Class function rb_class_new_instance passes arguments to the #initialize method
fails:C-API Class function rb_include_module includes a module into a class
fails:C-API Class function rb_define_attr defines an attr_reader when passed true, false
fails:C-API Class function rb_define_attr defines an attr_writer when passed false, true
fails:C-API Class function rb_define_attr defines an attr_accessor when passed true, true
fails:C-API Class function rb_call_super calls the method in the superclass
fails:C-API Class function rb_call_super calls the method in the superclass through two native levels
fails:C-API Class function rb_class2name returns the class name
fails:C-API Class function rb_class2name returns a string for an anonymous class
fails:C-API Class function rb_class_path returns a String of a class path with no scope modifiers
fails:C-API Class function rb_class_path returns a String of a class path with scope modifiers
fails:C-API Class function rb_class_name returns the class name
fails:C-API Class function rb_class_name returns a string for an anonymous class
fails:C-API Class function rb_path2class returns a class or module from a scoped String
fails:C-API Class function rb_path2class resolves autoload constants
fails:C-API Class function rb_path2class raises an ArgumentError if a constant in the path does not exist
fails:C-API Class function rb_path2class raises an ArgumentError if the final constant does not exist
fails:C-API Class function rb_path2class raises a TypeError if the constant is not a class or module
fails:C-API Class function rb_path2class raises an ArgumentError even if a constant in the path exists on toplevel
fails:C-API Class function rb_path_to_class returns a class or module from a scoped String
fails:C-API Class function rb_path_to_class resolves autoload constants
fails:C-API Class function rb_path_to_class raises an ArgumentError if a constant in the path does not exist
fails:C-API Class function rb_path_to_class raises an ArgumentError if the final constant does not exist
fails:C-API Class function rb_path_to_class raises a TypeError if the constant is not a class or module
fails:C-API Class function rb_path_to_class raises an ArgumentError even if a constant in the path exists on toplevel
fails:C-API Class function rb_cvar_defined returns false when the class variable is not defined
fails:C-API Class function rb_cvar_defined returns true when the class variable is defined
fails:C-API Class function rb_cvar_defined returns true if the class instance variable is defined
fails:C-API Class function rb_cv_set sets a class variable
fails:C-API Class function rb_cv_get returns the value of the class variable
fails:C-API Class function rb_cvar_set sets a class variable
fails:C-API Class function rb_define_class_under creates a subclass of the superclass contained in a module
fails:C-API Class function rb_define_class_under sets the class name
fails:C-API Class function rb_define_class_under calls #inherited on the superclass
fails:C-API Class function rb_define_class_under raises a TypeError when given a non class object to superclass
fails:C-API Class function rb_define_class_under raises a TypeError when given a mismatched class to superclass
fails:C-API Class function rb_define_class_under defines a class for an existing Autoload
fails:C-API Class function rb_define_class_under raises a TypeError if class is defined and its superclass mismatches the given one
fails:C-API Class function rb_define_class_id_under creates a subclass of the superclass contained in a module
fails:C-API Class function rb_define_class_id_under sets the class name
fails:C-API Class function rb_define_class_id_under calls #inherited on the superclass
fails:C-API Class function rb_define_class_id_under defines a class for an existing Autoload
fails:C-API Class function rb_define_class_id_under raises a TypeError if class is defined and its superclass mismatches the given one
fails:C-API Class function rb_define_class_variable sets a class variable
fails:C-API Class function rb_cvar_get returns the value of the class variable
fails:C-API Class function rb_class_new returns an new subclass of the superclass
fails:C-API Class function rb_class_new raises a TypeError if passed Class as the superclass
fails:C-API Class function rb_class_new raises a TypeError if passed a singleton class as the superclass
fails:C-API Class function rb_class_superclass returns the superclass of a class
fails:C-API Class function rb_class_superclass returns nil if the class has no superclass
fails:C-API Class function rb_class_real returns the class of an object ignoring the singleton class
fails:C-API Class function rb_class_real returns the class of an object ignoring included modules
fails:C-API Class function rb_class_real returns 0 if passed 0
5 changes: 5 additions & 0 deletions spec/truffle/tags/optional/capi/complex_tags.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
fails:CApiComplexSpecs rb_Complex creates a new Complex with numerator and denominator
fails:CApiComplexSpecs rb_Complex2 creates a new Complex with numerator and denominator
fails:CApiComplexSpecs rb_Complex1 creates a new Complex with real and imaginary of 0
fails:CApiComplexSpecs rb_complex_new creates a normalized Complex
fails:CApiComplexSpecs rb_complex_new2 creates a normalized Complex
61 changes: 61 additions & 0 deletions spec/truffle/tags/optional/capi/constants_tags.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
fails:C-API constant rb_cArray references the Array class
fails:C-API constant rb_cBignum references the Bignum class
fails:C-API constant rb_cClass references the Class class
fails:C-API constant rb_mComparable references the Comparable module
fails:C-API constant rb_cData references the Data class
fails:C-API constant rb_mEnumerable references the Enumerable module
fails:C-API constant rb_cFalseClass references the FalseClass class
fails:C-API constant rb_cFile references the File class
fails:C-API constant rb_cFixnum references the Fixnum class
fails:C-API constant rb_cFloat references the Float class
fails:C-API constant rb_cHash references the Hash class
fails:C-API constant rb_cInteger references the Integer class
fails:C-API constant rb_cIO references the IO class
fails:C-API constant rb_mKernel references the Kernel module
fails:C-API constant rb_cMatch references the MatchData class
fails:C-API constant rb_cModule references the Module class
fails:C-API constant rb_cNilClass references the NilClass class
fails:C-API constant rb_cNumeric references the Numeric class
fails:C-API constant rb_cObject references the Object class
fails:C-API constant rb_cRange references the Range class
fails:C-API constant rb_cRegexp references the Regexp class
fails:C-API constant rb_cString references the String class
fails:C-API constant rb_cStruct references the Struct class
fails:C-API constant rb_cSymbol references the Symbol class
fails:C-API constant rb_cThread references the Thread class
fails:C-API constant rb_cTrueClass references the TrueClass class
fails:C-API constant rb_cProc references the Proc class
fails:C-API constant rb_cMethod references the Method class
fails:C-API constant rb_cDir references the Dir class
fails:C-API exception constant rb_eArgError references the ArgumentError class
fails:C-API exception constant rb_eEOFError references the EOFError class
fails:C-API exception constant rb_eErrno references the Errno module
fails:C-API exception constant rb_eException references the Exception class
fails:C-API exception constant rb_eFloatDomainError references the FloatDomainError class
fails:C-API exception constant rb_eIndexError references the IndexError class
fails:C-API exception constant rb_eInterrupt references the Interrupt class
fails:C-API exception constant rb_eIOError references the IOError class
fails:C-API exception constant rb_eLoadError references the LoadError class
fails:C-API exception constant rb_eLocalJumpError references the LocalJumpError class
fails:C-API exception constant rb_eMathDomainError references the Math::DomainError class
fails:C-API exception constant rb_eEncCompatError references the Encoding::CompatibilityError
fails:C-API exception constant rb_eNameError references the NameError class
fails:C-API exception constant rb_eNoMemError references the NoMemoryError class
fails:C-API exception constant rb_eNoMethodError references the NoMethodError class
fails:C-API exception constant rb_eNotImpError references the NotImplementedError class
fails:C-API exception constant rb_eRangeError references the RangeError class
fails:C-API exception constant rb_eRegexpError references the RegexpError class
fails:C-API exception constant rb_eRuntimeError references the RuntimeError class
fails:C-API exception constant rb_eScriptError references the ScriptError class
fails:C-API exception constant rb_eSecurityError references the SecurityError class
fails:C-API exception constant rb_eSignal references the SignalException class
fails:C-API exception constant rb_eStandardError references the StandardError class
fails:C-API exception constant rb_eSyntaxError references the SyntaxError class
fails:C-API exception constant rb_eSystemCallError references the SystemCallError class
fails:C-API exception constant rb_eSystemExit references the SystemExit class
fails:C-API exception constant rb_eSysStackError references the SystemStackError class
fails:C-API exception constant rb_eTypeError references the TypeError class
fails:C-API exception constant rb_eThreadError references the ThreadError class
fails:C-API exception constant rb_mWaitReadable references the IO::WaitReadable module
fails:C-API exception constant rb_mWaitWritable references the IO::WaitWritable module
fails:C-API exception constant rb_eZeroDivError references the ZeroDivisionError class
4 changes: 4 additions & 0 deletions spec/truffle/tags/optional/capi/enumerator_tags.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
fails:C-API Enumerator function rb_enumeratorize constructs a new Enumerator for the given object, method and arguments
fails:C-API Enumerator function rb_enumeratorize enumerates the given object
fails:C-API Enumerator function rb_enumeratorize uses the given method for enumeration
fails:C-API Enumerator function rb_enumeratorize passes the given arguments to the enumeration method
8 changes: 8 additions & 0 deletions spec/truffle/tags/optional/capi/exception_tags.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
fails:C-API Exception function rb_exc_new creates an exception from a C string and length
fails:C-API Exception function rb_exc_new2 creates an exception from a C string
fails:C-API Exception function rb_exc_new3 creates an exception from a Ruby string
fails:C-API Exception function rb_exc_raise raises passed exception
fails:C-API Exception function rb_exc_raise raises an exception with an empty backtrace
fails:C-API Exception function rb_set_errinfo accepts nil
fails:C-API Exception function rb_set_errinfo accepts an Exception instance
fails:C-API Exception function rb_set_errinfo raises a TypeError if the object is not nil or an Exception instance
14 changes: 14 additions & 0 deletions spec/truffle/tags/optional/capi/file_tags.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
fails:C-API File function rb_file_open raises an ArgumentError if passed an empty mode string
fails:C-API File function rb_file_open opens a file in read-only mode with 'r'
fails:C-API File function rb_file_open creates and opens a non-existent file with 'w'
fails:C-API File function rb_file_open truncates an existing file with 'w'
fails:C-API File function rb_file_open_str raises an ArgumentError if passed an empty mode string
fails:C-API File function rb_file_open_str opens a file in read-only mode with 'r'
fails:C-API File function rb_file_open_str creates and opens a non-existent file with 'w'
fails:C-API File function rb_file_open_str truncates an existing file with 'w'
fails:C-API File function rb_file_open_str calls #to_path to convert on object to a path
fails:C-API File function rb_file_open_str calls #to_str to convert an object to a path if #to_path isn't defined
fails:C-API File function FilePathValue returns a String argument unchanged
fails:C-API File function FilePathValue does not call #to_str on a String
fails:C-API File function FilePathValue calls #to_path to convert an object to a String
fails:C-API File function FilePathValue calls #to_str to convert an object to a String if #to_path isn't defined
14 changes: 14 additions & 0 deletions spec/truffle/tags/optional/capi/fixnum_tags.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
fails:CApiFixnumSpecs rb_fix2uint raises a TypeError if passed nil
fails:CApiFixnumSpecs rb_fix2uint converts a Fixnum
fails:CApiFixnumSpecs rb_fix2uint converts the maximum uint value
fails:CApiFixnumSpecs rb_fix2uint converts a Float
fails:CApiFixnumSpecs rb_fix2uint raises a RangeError if the value is more than 32bits
fails:CApiFixnumSpecs rb_fix2uint raises a RangeError if the value is more than 64bits
fails:CApiFixnumSpecs rb_fix2int raises a TypeError if passed nil
fails:CApiFixnumSpecs rb_fix2int converts a Fixnum
fails:CApiFixnumSpecs rb_fix2int converts the maximum uint value
fails:CApiFixnumSpecs rb_fix2int converts a Float
fails:CApiFixnumSpecs rb_fix2int converts a negative Bignum into an signed number
fails:CApiFixnumSpecs rb_fix2int raises a RangeError if the value is more than 32bits
fails:CApiFixnumSpecs rb_fix2int raises a RangeError if the value is more than 64bits
fails:CApiFixnumSpecs rb_fix2int calls #to_int to coerce the value
3 changes: 3 additions & 0 deletions spec/truffle/tags/optional/capi/float_tags.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
fails:CApiFloatSpecs rb_float_new creates a new float
fails:CApiFloatSpecs RFLOAT_VALUE returns the C double value of the Float
fails:CApiFloatSpecs rb_Float creates a new Float from a String
5 changes: 5 additions & 0 deletions spec/truffle/tags/optional/capi/gc_tags.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
fails:CApiGCSpecs correctly gets the value from a registered address
fails:CApiGCSpecs rb_gc_enable enables GC when disabled
fails:CApiGCSpecs rb_gc_enable GC stays enabled when enabled
fails:CApiGCSpecs rb_gc_enable disables GC when enabled
fails:CApiGCSpecs rb_gc_enable GC stays disabled when disabled
35 changes: 35 additions & 0 deletions spec/truffle/tags/optional/capi/globals_tags.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
fails:CApiGlobalSpecs correctly gets global values
fails:CApiGlobalSpecs returns $~
fails:CApiGlobalSpecs correctly sets global values
fails:CApiGlobalSpecs lists all global variables
fails:CApiGlobalSpecs rb_define_readonly_variable should define a new readonly global variable
fails:CApiGlobalSpecs rb_rs returns \n by default
fails:CApiGlobalSpecs rb_rs returns the value of $/
fails:CApiGlobalSpecs rb_std streams rb_stdin returns $stdin
fails:CApiGlobalSpecs rb_std streams rb_stdout returns $stdout
fails:CApiGlobalSpecs rb_std streams rb_stderr returns $stderr
fails:CApiGlobalSpecs rb_std streams rb_defout returns $stdout
fails:CApiGlobalSpecs rb_default_rs returns \n
fails:CApiGlobalSpecs rb_output_rs returns nil by default
fails:CApiGlobalSpecs rb_output_rs returns the value of $\
fails:CApiGlobalSpecs rb_output_fs returns nil by default
fails:CApiGlobalSpecs rb_output_fs returns the value of $\
fails:CApiGlobalSpecs rb_lastline_set sets the value of $_
fails:CApiGlobalSpecs rb_lastline_set sets a Thread-local value
fails:CApiGlobalSpecs rb_lastline_get gets the value of $_
fails:CApiGlobalSpecs rb_lastline_get gets a Thread-local value
fails:CApiGlobalSpecs rb_rs returns \n by default
fails:CApiGlobalSpecs rb_rs returns the value of $/
fails:CApiGlobalSpecs rb_std streams rb_stdin returns $stdin
fails:CApiGlobalSpecs rb_std streams rb_stdout returns $stdout
fails:CApiGlobalSpecs rb_std streams rb_stderr returns $stderr
fails:CApiGlobalSpecs rb_std streams rb_defout returns $stdout
fails:CApiGlobalSpecs rb_default_rs returns \n
fails:CApiGlobalSpecs rb_output_rs returns nil by default
fails:CApiGlobalSpecs rb_output_rs returns the value of $\
fails:CApiGlobalSpecs rb_output_fs returns nil by default
fails:CApiGlobalSpecs rb_output_fs returns the value of $\
fails:CApiGlobalSpecs rb_lastline_set sets the value of $_
fails:CApiGlobalSpecs rb_lastline_set sets a Thread-local value
fails:CApiGlobalSpecs rb_lastline_get gets the value of $_
fails:CApiGlobalSpecs rb_lastline_get gets a Thread-local value
27 changes: 27 additions & 0 deletions spec/truffle/tags/optional/capi/hash_tags.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
fails:C-API Hash function rb_hash calls #hash on the object
fails:C-API Hash function rb_hash converts a Bignum returned by #hash to a Fixnum
fails:C-API Hash function rb_hash calls #to_int to converts a value returned by #hash to a Fixnum
fails:C-API Hash function rb_hash raises a TypeError if the object does not implement #to_int
fails:C-API Hash function rb_hash_new returns a new hash
fails:C-API Hash function rb_hash_new creates a hash with no default proc
fails:C-API Hash function rb_hash_dup returns a copy of the hash
fails:C-API Hash function rb_hash_freeze freezes the hash
fails:C-API Hash function rb_hash_aref returns the value associated with the key
fails:C-API Hash function rb_hash_aref returns the default value if it exists
fails:C-API Hash function rb_hash_aref returns nil if the key does not exist
fails:C-API Hash function rb_hash_aset adds the key/value pair and returns the value
fails:C-API Hash function rb_hash_clear returns self that cleared keys and values
fails:C-API Hash function rb_hash_delete removes the key and returns the value
fails:C-API Hash function rb_hash_delete_if removes an entry if the block returns true
fails:C-API Hash function rb_hash_delete_if returns an Enumerator when no block is passed
fails:C-API Hash function rb_hash_foreach iterates over the hash
fails:C-API Hash function rb_hash_foreach stops via the callback
fails:C-API Hash function rb_hash_foreach deletes via the callback
fails:C-API Hash function rb_hash_size returns the size of the hash
fails:C-API Hash function rb_hash_size returns zero for an empty hash
fails:C-API Hash function rb_hash_lookup returns the value associated with the key
fails:C-API Hash function rb_hash_lookup does not return the default value if it exists
fails:C-API Hash function rb_hash_lookup returns nil if the key does not exist
fails:C-API Hash function rb_hash_lookup rb_hash_lookup2 returns the value associated with the key
fails:C-API Hash function rb_hash_lookup rb_hash_lookup2 returns the default value if the key does not exist
fails:C-API Hash function rb_hash_set_ifnone sets the default value of non existing keys
25 changes: 25 additions & 0 deletions spec/truffle/tags/optional/capi/integer_tags.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
fails:CApiIntegerSpecs rb_integer_pack converts zero
fails:CApiIntegerSpecs rb_integer_pack without two's complement flag with big endian output converts a positive number
fails:CApiIntegerSpecs rb_integer_pack without two's complement flag with big endian output converts a negative number
fails:CApiIntegerSpecs rb_integer_pack without two's complement flag with big endian output converts a negative number exactly -2**(numwords*wordsize*8)
fails:CApiIntegerSpecs rb_integer_pack without two's complement flag with little endian output converts a positive number
fails:CApiIntegerSpecs rb_integer_pack without two's complement flag with little endian output converts a negative number
fails:CApiIntegerSpecs rb_integer_pack without two's complement flag with little endian output converts a negative number exactly -2**(numwords*wordsize*8)
fails:CApiIntegerSpecs rb_integer_pack with two's complement flag with input less than 64 bits with big endian output converts a positive number
fails:CApiIntegerSpecs rb_integer_pack with two's complement flag with input less than 64 bits with big endian output converts a negative number
fails:CApiIntegerSpecs rb_integer_pack with two's complement flag with input less than 64 bits with little endian output converts a positive number
fails:CApiIntegerSpecs rb_integer_pack with two's complement flag with input less than 64 bits with little endian output converts a negative number
fails:CApiIntegerSpecs rb_integer_pack with two's complement flag with input less than 64 bits with native endian output converts a positive number
fails:CApiIntegerSpecs rb_integer_pack with two's complement flag with input less than 64 bits with native endian output converts a negative number
fails:CApiIntegerSpecs rb_integer_pack with two's complement flag with input greater than 64 bits with big endian output converts a positive number
fails:CApiIntegerSpecs rb_integer_pack with two's complement flag with input greater than 64 bits with big endian output converts a negative number
fails:CApiIntegerSpecs rb_integer_pack with two's complement flag with input greater than 64 bits with big endian output with overflow converts a positive number
fails:CApiIntegerSpecs rb_integer_pack with two's complement flag with input greater than 64 bits with big endian output with overflow converts a negative number
fails:CApiIntegerSpecs rb_integer_pack with two's complement flag with input greater than 64 bits with big endian output with overflow converts a negative number exactly -2**(numwords*wordsize*8)
fails:CApiIntegerSpecs rb_integer_pack with two's complement flag with input greater than 64 bits with little endian output converts a positive number
fails:CApiIntegerSpecs rb_integer_pack with two's complement flag with input greater than 64 bits with little endian output converts a negative number
fails:CApiIntegerSpecs rb_integer_pack with two's complement flag with input greater than 64 bits with little endian output with overflow converts a positive number
fails:CApiIntegerSpecs rb_integer_pack with two's complement flag with input greater than 64 bits with little endian output with overflow converts a negative number
fails:CApiIntegerSpecs rb_integer_pack with two's complement flag with input greater than 64 bits with little endian output with overflow converts a negative number exactly -2**(numwords*wordsize*8)
fails:CApiIntegerSpecs rb_integer_pack with two's complement flag with input greater than 64 bits with native endian output converts a positive number
fails:CApiIntegerSpecs rb_integer_pack with two's complement flag with input greater than 64 bits with native endian output converts a negative number
62 changes: 62 additions & 0 deletions spec/truffle/tags/optional/capi/kernel_tags.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
fails:C-API Kernel function rb_block_given_p returns false if no block is passed
fails:C-API Kernel function rb_block_given_p returns true if a block is passed
fails:C-API Kernel function rb_need_block raises a LocalJumpError if no block is given
fails:C-API Kernel function rb_need_block does not raise a LocalJumpError if a block is given
fails:C-API Kernel function rb_block_call calls the block with a single argument
fails:C-API Kernel function rb_block_call calls the block with multiple arguments in argc / argv
fails:C-API Kernel function rb_block_call calls the method with no function callback and no block
fails:C-API Kernel function rb_block_call calls the method with no function callback and a block
fails:C-API Kernel function rb_raise raises an exception
fails:C-API Kernel function rb_raise terminates the function at the point it was called
fails:C-API Kernel function rb_throw sets the return value of the catch block to the specified value
fails:C-API Kernel function rb_throw terminates the function at the point it was called
fails:C-API Kernel function rb_throw raises an ArgumentError if there is no catch block for the symbol
fails:C-API Kernel function rb_throw_obj sets the return value of the catch block to the specified value
fails:C-API Kernel function rb_throw_obj terminates the function at the point it was called
fails:C-API Kernel function rb_throw_obj raises an ArgumentError if there is no catch block for the symbol
fails:C-API Kernel function rb_warn prints a message to $stderr if $VERBOSE evaluates to true
fails:C-API Kernel function rb_warn prints a message to $stderr if $VERBOSE evaluates to false
fails:C-API Kernel function rb_sys_fail raises an exception from the value of errno
fails:C-API Kernel function rb_sys_fail can take a NULL message
fails:C-API Kernel function rb_syserr_fail raises an exception from the given error
fails:C-API Kernel function rb_syserr_fail can take a NULL message
fails:C-API Kernel function rb_yield yields passed argument
fails:C-API Kernel function rb_yield returns the result from block evaluation
fails:C-API Kernel function rb_yield raises LocalJumpError when no block is given
fails:C-API Kernel function rb_yield_values yields passed arguments
fails:C-API Kernel function rb_yield_values returns the result from block evaluation
fails:C-API Kernel function rb_yield_values raises LocalJumpError when no block is given
fails:C-API Kernel function rb_yield_splat yields with passed array's contents
fails:C-API Kernel function rb_yield_splat returns the result from block evaluation
fails:C-API Kernel function rb_yield_splat raises LocalJumpError when no block is given
fails:C-API Kernel function rb_rescue executes passed function
fails:C-API Kernel function rb_rescue executes passed 'raise function' if a StandardError exception is raised
fails:C-API Kernel function rb_rescue passes the user supplied argument to the 'raise function' if a StandardError exception is raised
fails:C-API Kernel function rb_rescue passes the raised exception to the 'raise function' if a StandardError exception is raised
fails:C-API Kernel function rb_rescue raises an exception if passed function raises an exception other than StandardError
fails:C-API Kernel function rb_rescue raises an exception if any exception is raised inside 'raise function'
fails:C-API Kernel function rb_rescue makes $! available only during 'raise function' execution
fails:C-API Kernel function rb_rescue returns the break value if the passed function yields to a block with a break
fails:C-API Kernel function rb_rescue2 only rescues if one of the passed exceptions is raised
fails:C-API Kernel function rb_catch executes passed function
fails:C-API Kernel function rb_catch terminates the function at the point it was called
fails:C-API Kernel function rb_catch raises an ArgumentError if the throw symbol isn't caught
fails:C-API Kernel function rb_catch_obj executes passed function
fails:C-API Kernel function rb_catch_obj terminates the function at the point it was called
fails:C-API Kernel function rb_catch_obj raises an ArgumentError if the throw symbol isn't caught
fails:C-API Kernel function rb_ensure executes passed function and returns its value
fails:C-API Kernel function rb_ensure executes passed 'ensure function' when no exception is raised
fails:C-API Kernel function rb_ensure executes passed 'ensure function' when an exception is raised
fails:C-API Kernel function rb_ensure raises the same exception raised inside passed function
fails:C-API Kernel function rb_eval_string evaluates a string of ruby code
fails:C-API Kernel function rb_block_proc converts the implicit block into a proc
fails:C-API Kernel function rb_exec_recursive detects recursive invocations of a method and indicates as such
fails:C-API Kernel function rb_set_end_proc runs a C function on shutdown
fails:C-API Kernel function rb_f_sprintf returns a string according to format and arguments
fails:C-API Kernel function rb_make_backtrace returns a caller backtrace
fails:C-API Kernel function rb_obj_method returns the method object for a symbol
fails:C-API Kernel function rb_obj_method returns the method object for a string
fails:C-API Kernel function rb_funcall3 calls a public method
fails:C-API Kernel function rb_funcall3 does not call a private method
fails:C-API Kernel function rb_funcall_with_block calls a method with block
fails:C-API Kernel function rb_funcall_with_block does not call a private method
3 changes: 3 additions & 0 deletions spec/truffle/tags/optional/capi/marshal_tags.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
fails:CApiMarshalSpecs rb_marshal_dump marshals an object
fails:CApiMarshalSpecs rb_marshal_dump marshals an object and write to an IO when passed
fails:CApiMarshalSpecs rb_marshal_load unmarshals an object
44 changes: 44 additions & 0 deletions spec/truffle/tags/optional/capi/module_tags.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
fails:CApiModule rb_define_global_const defines a constant on Object
fails:CApiModule rb_const_set given a symbol name and a value sets a new constant on a module
fails:CApiModule rb_const_set given a symbol name and a value sets an existing constant's value
fails:CApiModule rb_define_module_under creates a new module inside the inner class
fails:CApiModule rb_define_module_under sets the module name
fails:CApiModule rb_define_module_under defines a module for an existing Autoload with an extension
fails:CApiModule rb_define_const given a String name and a value defines a new constant on a module
fails:CApiModule rb_define_const given a String name and a value sets an existing constant's value
fails:CApiModule rb_const_defined returns C non-zero if a constant is defined
fails:CApiModule rb_const_defined returns C non-zero if a constant is defined in Object
fails:CApiModule rb_const_defined_at returns C non-zero if a constant is defined
fails:CApiModule rb_const_defined_at does not search in ancestors for the constant
fails:CApiModule rb_const_defined_at does not search in Object
fails:CApiModule rb_const_get returns a constant defined in the module
fails:CApiModule rb_const_get returns a constant defined at toplevel
fails:CApiModule rb_const_get returns a constant defined in a superclass
fails:CApiModule rb_const_get calls #const_missing if the constant is not defined in the class or ancestors
fails:CApiModule rb_const_get resolves autoload constants in classes
fails:CApiModule rb_const_get resolves autoload constants in Object
fails:CApiModule rb_const_get_from returns a constant defined in the module
fails:CApiModule rb_const_get_from returns a constant defined in a superclass
fails:CApiModule rb_const_get_from calls #const_missing if the constant is not defined in the class or ancestors
fails:CApiModule rb_const_get_from resolves autoload constants
fails:CApiModule rb_const_get_at returns a constant defined in the module
fails:CApiModule rb_const_get_at resolves autoload constants
fails:CApiModule rb_const_get_at calls #const_missing if the constant is not defined in the module
fails:CApiModule rb_define_alias defines an alias for an existing method
fails:CApiModule rb_alias defines an alias for an existing method
fails:CApiModule rb_define_global_function defines a method on Object
fails:CApiModule rb_define_method defines a method on a class
fails:CApiModule rb_define_method defines a method on a module
fails:CApiModule rb_define_module_function defines a module function
fails:CApiModule rb_define_module_function defines a private instance method
fails:CApiModule rb_define_private_method defines a private method on a class
fails:CApiModule rb_define_private_method defines a private method on a module
fails:CApiModule rb_define_protected_method defines a protected method on a class
fails:CApiModule rb_define_protected_method defines a protected method on a module
fails:CApiModule rb_define_singleton_method defines a method on the singleton class
fails:CApiModule rb_undef_method undef'ines a method on a class
fails:CApiModule rb_undef_method does not raise exceptions when passed a missing name
fails:CApiModule rb_undef_method when given a frozen Class raises a RuntimeError when passed a name
fails:CApiModule rb_undef_method when given a frozen Class raises a RuntimeError when passed a missing name
fails:CApiModule rb_undef undef'ines a method on a class
fails:CApiModule rb_class2name returns the module name
11 changes: 11 additions & 0 deletions spec/truffle/tags/optional/capi/mutex_tags.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
fails:C-API Mutex functions rb_mutex_new creates a new mutex
fails:C-API Mutex functions rb_mutex_locked_p returns true if the mutex is locked
fails:C-API Mutex functions rb_mutex_trylock locks the mutex if not locked
fails:C-API Mutex functions rb_mutex_trylock returns false if the mutex is already locked
fails:C-API Mutex functions rb_mutex_lock returns when the mutex isn't locked
fails:C-API Mutex functions rb_mutex_lock throws an exception when already locked in the same thread
fails:C-API Mutex functions rb_mutex_unlock raises an exception when not locked
fails:C-API Mutex functions rb_mutex_unlock unlocks the mutex when locked
fails:C-API Mutex functions rb_mutex_sleep throws an exception when the mutex is not locked
fails:C-API Mutex functions rb_mutex_sleep sleeps when the mutex is locked
fails:C-API Mutex functions rb_mutex_synchronize calls the function while the mutex is locked
69 changes: 69 additions & 0 deletions spec/truffle/tags/optional/capi/numeric_tags.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
fails:CApiNumericSpecs rb_num2int raises a TypeError if passed nil
fails:CApiNumericSpecs rb_num2int converts a Float
fails:CApiNumericSpecs rb_num2int converts a Bignum
fails:CApiNumericSpecs rb_num2int converts a Fixnum
fails:CApiNumericSpecs rb_num2int converts -1 to an signed number
fails:CApiNumericSpecs rb_num2int converts a negative Bignum into an signed number
fails:CApiNumericSpecs rb_num2int raises a RangeError if the value is more than 32bits
fails:CApiNumericSpecs rb_num2int calls #to_int to coerce the value
fails:CApiNumericSpecs rb_num2uint raises a TypeError if passed nil
fails:CApiNumericSpecs rb_num2uint converts a Float
fails:CApiNumericSpecs rb_num2uint converts a Bignum
fails:CApiNumericSpecs rb_num2uint converts a Fixnum
fails:CApiNumericSpecs rb_num2uint converts a negative number to the complement
fails:CApiNumericSpecs rb_num2uint converts a signed int value to the complement
fails:CApiNumericSpecs rb_num2uint raises a RangeError if the value is more than 32bits
fails:CApiNumericSpecs rb_num2uint raises a RangeError if the value is less than 32bits negative
fails:CApiNumericSpecs rb_num2uint raises a RangeError if the value is more than 64bits
fails:CApiNumericSpecs rb_num2uint calls #to_int to coerce the value
fails:CApiNumericSpecs rb_num2long raises a TypeError if passed nil
fails:CApiNumericSpecs rb_num2long converts a Float
fails:CApiNumericSpecs rb_num2long converts a Bignum
fails:CApiNumericSpecs rb_num2long converts a Fixnum
fails:CApiNumericSpecs rb_num2long converts -1 to an signed number
fails:CApiNumericSpecs rb_num2long converts a negative Bignum into an signed number
fails:CApiNumericSpecs rb_num2long raises a RangeError if the value is more than 64bits
fails:CApiNumericSpecs rb_num2long calls #to_int to coerce the value
fails:CApiNumericSpecs rb_int2num raises a TypeError if passed nil
fails:CApiNumericSpecs rb_int2num converts a Float
fails:CApiNumericSpecs rb_int2num raises a RangeError when passed a Bignum
fails:CApiNumericSpecs rb_int2num converts a Fixnum
fails:CApiNumericSpecs rb_int2num converts a negative Fixnum
fails:CApiNumericSpecs rb_num2ulong raises a TypeError if passed nil
fails:CApiNumericSpecs rb_num2ulong converts a Float
fails:CApiNumericSpecs rb_num2ulong converts a Bignum
fails:CApiNumericSpecs rb_num2ulong converts a Fixnum
fails:CApiNumericSpecs rb_num2ulong converts -1 to an unsigned number
fails:CApiNumericSpecs rb_num2ulong converts a negative Bignum into an unsigned number
fails:CApiNumericSpecs rb_num2ulong raises a RangeError if the value is more than 64bits
fails:CApiNumericSpecs rb_num2ulong calls #to_int to coerce the value
fails:CApiNumericSpecs rb_Integer creates a new Integer from a String
fails:CApiNumericSpecs rb_ll2inum creates a new Fixnum from a small signed long long
fails:CApiNumericSpecs rb_int2inum creates a new Fixnum from a long
fails:CApiNumericSpecs rb_num2dbl raises a TypeError if passed nil
fails:CApiNumericSpecs rb_num2dbl raises a TypeError if passed a String
fails:CApiNumericSpecs rb_num2dbl converts a Float
fails:CApiNumericSpecs rb_num2dbl converts a Bignum
fails:CApiNumericSpecs rb_num2dbl converts a Fixnum
fails:CApiNumericSpecs rb_num2dbl calls #to_f to coerce the value
fails:CApiNumericSpecs NUM2CHR returns the first character of a String
fails:CApiNumericSpecs NUM2CHR returns the least significant byte of an Integer
fails:CApiNumericSpecs NUM2CHR returns the least significant byte of a Float converted to an Integer
fails:CApiNumericSpecs NUM2CHR raises a TypeError when passed an empty String
fails:CApiNumericSpecs rb_num_zerodiv raises a RuntimeError
fails:CApiNumericSpecs rb_cmpint returns a Fixnum if passed one
fails:CApiNumericSpecs rb_cmpint uses > to check if the value is greater than 1
fails:CApiNumericSpecs rb_cmpint uses < to check if the value is less than 1
fails:CApiNumericSpecs rb_cmpint returns 0 if < and > are false
fails:CApiNumericSpecs rb_cmpint raises an ArgumentError when passed nil
fails:CApiNumericSpecs rb_num_coerce_bin calls #coerce on the first argument
fails:CApiNumericSpecs rb_num_coerce_bin calls the specified method on the first argument returned by #coerce
fails:CApiNumericSpecs rb_num_coerce_bin raises a TypeError if #coerce does not return an Array
fails:CApiNumericSpecs rb_num_coerce_cmp calls #coerce on the first argument
fails:CApiNumericSpecs rb_num_coerce_cmp calls the specified method on the first argument returned by #coerce
fails:CApiNumericSpecs rb_num_coerce_cmp returns nil if passed nil
fails:CApiNumericSpecs rb_num_coerce_cmp returns nil if #coerce does not return an Array
fails:CApiNumericSpecs rb_num_coerce_relop calls #coerce on the first argument
fails:CApiNumericSpecs rb_num_coerce_relop calls the specified method on the first argument returned by #coerce
fails:CApiNumericSpecs rb_num_coerce_relop raises an ArgumentError if #<op> returns nil
fails:CApiNumericSpecs rb_num_coerce_relop raises an ArgumentError if #coerce does not return an Array
102 changes: 102 additions & 0 deletions spec/truffle/tags/optional/capi/object_tags.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
fails:CApiObject rb_obj_alloc allocates a new uninitialized object
fails:CApiObject rb_obj_dup duplicates an object
fails:CApiObject rb_obj_call_init sends #initialize
fails:CApiObject rb_is_instance_of returns true if an object is an instance
fails:CApiObject rb_is_kind_of returns true if an object is an instance or descendent
fails:CApiObject rb_respond_to returns 1 if respond_to? is true and 0 if respond_to? is false
fails:CApiObject rb_obj_respond_to returns true if respond_to? is true and false if respond_to? is false
fails:CApiObject rb_method_boundp returns true when the given method is bound
fails:CApiObject rb_method_boundp returns false when the given method is not bound
fails:CApiObject rb_to_id returns a symbol representation of the object
fails:CApiObject rb_require requires a ruby file
fails:CApiObject rb_attr_get gets an instance variable
fails:CApiObject rb_obj_instance_variables returns an array with instance variable names as symbols
fails:CApiObject rb_check_convert_type returns the passed object and does not call the converting method if the object is the specified type
fails:CApiObject rb_check_convert_type returns the passed object and does not call the converting method if the object is a subclass of the specified type
fails:CApiObject rb_check_convert_type returns nil if the converting method returns nil
fails:CApiObject rb_check_convert_type raises a TypeError if the converting method returns an object that is not the specified type
fails:CApiObject rb_convert_type returns the passed object and does not call the converting method if the object is the specified type
fails:CApiObject rb_convert_type returns the passed object and does not call the converting method if the object is a subclass of the specified type
fails:CApiObject rb_convert_type raises a TypeError if the converting method returns nil
fails:CApiObject rb_convert_type raises a TypeError if the converting method returns an object that is not the specified type
fails:CApiObject rb_check_array_type returns the argument if it's an Array
fails:CApiObject rb_check_array_type returns the argument if it's a kind of Array
fails:CApiObject rb_check_array_type returns nil when the argument does not respond to #to_ary
fails:CApiObject rb_check_array_type sends #to_ary to the argument and returns the result if it's nil
fails:CApiObject rb_check_array_type sends #to_ary to the argument and returns the result if it's an Array
fails:CApiObject rb_check_array_type sends #to_ary to the argument and returns the result if it's a kind of Array
fails:CApiObject rb_check_array_type sends #to_ary to the argument and raises TypeError if it's not a kind of Array
fails:CApiObject rb_check_array_type does not rescue exceptions raised by #to_ary
fails:CApiObject rb_check_string_type returns the argument if it's a String
fails:CApiObject rb_check_string_type returns the argument if it's a kind of String
fails:CApiObject rb_check_string_type returns nil when the argument does not respond to #to_str
fails:CApiObject rb_check_string_type sends #to_str to the argument and returns the result if it's nil
fails:CApiObject rb_check_string_type sends #to_str to the argument and returns the result if it's a String
fails:CApiObject rb_check_string_type sends #to_str to the argument and returns the result if it's a kind of String
fails:CApiObject rb_check_string_type sends #to_str to the argument and raises TypeError if it's not a kind of String
fails:CApiObject rb_check_string_type does not rescue exceptions raised by #to_str
fails:CApiObject rb_check_to_integer returns the object when passed a Fixnum
fails:CApiObject rb_check_to_integer returns the object when passed a Bignum
fails:CApiObject rb_check_to_integer calls the converting method and returns a Fixnum value
fails:CApiObject rb_check_to_integer calls the converting method and returns a Bignum value
fails:CApiObject rb_check_to_integer returns nil when the converting method returns nil
fails:CApiObject rb_check_to_integer returns nil when the converting method does not return an Integer
fails:CApiObject rb_inspect returns a string with the inspect representation
fails:CApiObject rb_class_of returns the class of an object
fails:CApiObject rb_obj_classname returns the class name of an object
fails:CApiObject rb_type returns the type constant for the object
fails:CApiObject rb_type_p returns whether object is of the given type
fails:CApiObject BUILTIN_TYPE returns the type constant for the object
fails:CApiObject RTEST returns C false if passed Qfalse
fails:CApiObject RTEST returns C false if passed Qnil
fails:CApiObject RTEST returns C true if passed Qtrue
fails:CApiObject RTEST returns C true if passed a Symbol
fails:CApiObject RTEST returns C true if passed an Object
fails:CApiObject rb_special_const_p returns true if passed Qfalse
fails:CApiObject rb_special_const_p returns true if passed Qtrue
fails:CApiObject rb_special_const_p returns true if passed Qnil
fails:CApiObject rb_special_const_p returns true if passed a Symbol
fails:CApiObject rb_special_const_p returns true if passed a Fixnum
fails:CApiObject rb_special_const_p returns false if passed an Object
fails:CApiObject rb_extend_object adds the module's instance methods to the object
fails:CApiObject OBJ_TAINT taints the object
fails:CApiObject OBJ_TAINTED returns C true if the object is tainted
fails:CApiObject OBJ_TAINTED returns C false if the object is not tainted
fails:CApiObject OBJ_INFECT does not taint the first argument if the second argument is not tainted
fails:CApiObject OBJ_INFECT taints the first argument if the second argument is tainted
fails:CApiObject OBJ_INFECT does not untrust the first argument if the second argument is trusted
fails:CApiObject OBJ_INFECT untrusts the first argument if the second argument is untrusted
fails:CApiObject OBJ_INFECT propagates both taint and distrust
fails:CApiObject rb_obj_freeze freezes the object passed to it
fails:CApiObject rb_obj_instance_eval evaluates the block in the object context, that includes private methods
fails:CApiObject rb_obj_frozen_p returns true if object passed to it is frozen
fails:CApiObject rb_obj_frozen_p returns false if object passed to it is not frozen
fails:CApiObject rb_obj_taint marks the object passed as tainted
fails:CApiObject rb_obj_taint raises a RuntimeError if the object passed is frozen
fails:CApiObject rb_check_frozen raises a RuntimeError if the obj is frozen
fails:CApiObject rb_check_frozen does nothing when object isn't frozen
fails:CApiObject rb_any_to_s converts obj to string
fails:CApiObject rb_to_int returns self when called on an Integer
fails:CApiObject rb_to_int returns self when called on a Bignum
fails:CApiObject rb_to_int calls #to_int to convert and object to an integer
fails:CApiObject rb_to_int converts a Float to an Integer by truncation
fails:CApiObject rb_to_int raises a TypeError if #to_int does not return an Integer
fails:CApiObject rb_to_int raises a TypeError if called with nil
fails:CApiObject rb_to_int raises a TypeError if called with true
fails:CApiObject rb_to_int raises a TypeError if called with false
fails:CApiObject rb_to_int raises a TypeError if called with a String
fails:CApiObject rb_equal returns true if the arguments are the same exact object
fails:CApiObject rb_equal calls == to check equality and coerces to true/false
fails:CApiObject rb_class_inherited_p returns true if mod equals arg
fails:CApiObject rb_class_inherited_p returns true if mod is a subclass of arg
fails:CApiObject rb_class_inherited_p returns nil if mod is not a subclass of arg
fails:CApiObject rb_class_inherited_p raises a TypeError if arg is no class or module
fails:CApiObject instance variable access rb_iv_get returns the instance variable on an object
fails:CApiObject instance variable access rb_iv_get returns nil if the instance variable has not been initialized
fails:CApiObject instance variable access rb_iv_set sets and returns the instance variable on an object
fails:CApiObject instance variable access rb_iv_set sets and returns the instance variable with a bare name
fails:CApiObject instance variable access rb_ivar_get returns the instance variable on an object
fails:CApiObject instance variable access rb_ivar_get returns nil if the instance variable has not been initialized
fails:CApiObject instance variable access rb_ivar_set sets and returns the instance variable on an object
fails:CApiObject instance variable access rb_ivar_defined returns true if the instance variable is defined
fails:CApiObject instance variable access rb_ivar_defined returns false if the instance variable is not defined
4 changes: 4 additions & 0 deletions spec/truffle/tags/optional/capi/range_tags.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
fails:C-API Range function rb_range_new constructs a range using the given start and end
fails:C-API Range function rb_range_new includes the end object when the third parameter is omitted or false
fails:C-API Range function rb_range_new raises an ArgumentError when the given start and end can't be compared by using #<=>
fails:C-API Range function rb_range_values stores the range properties
7 changes: 7 additions & 0 deletions spec/truffle/tags/optional/capi/rational_tags.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
fails:CApiRationalSpecs rb_Rational creates a new Rational with numerator and denominator
fails:CApiRationalSpecs rb_Rational2 creates a new Rational with numerator and denominator
fails:CApiRationalSpecs rb_Rational1 creates a new Rational with numerator and denominator of 1
fails:CApiRationalSpecs rb_rational_new creates a normalized Rational
fails:CApiRationalSpecs rb_rational_new2 creates a normalized Rational
fails:CApiRationalSpecs rb_rational_num returns the numerator of a Rational
fails:CApiRationalSpecs rb_rational_den returns the denominator of a Rational
109 changes: 109 additions & 0 deletions spec/truffle/tags/optional/capi/string_tags.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
fails:C-API String function rb_str_set_len reduces the size of the string
fails:C-API String function rb_str_set_len inserts a NULL byte at the length
fails:C-API String function rb_str_set_len updates the string's attributes visible in C code
fails:C-API String function rb_str_buf_new returns the equivalent of an empty string
fails:C-API String function rb_str_buf_new returns a string that can be appended to
fails:C-API String function rb_str_buf_new returns a string that can be concatenated to another string
fails:C-API String function rb_str_buf_new returns a string whose bytes can be accessed by RSTRING_PTR
fails:C-API String function rb_str_buf_new returns a string that can be modified by rb_str_set_len
fails:C-API String function rb_str_buf_new2 returns a new string object calling strlen on the passed C string
fails:C-API String function rb_str_new returns a new string object from a char buffer of len characters
fails:C-API String function rb_str_new returns an empty string if len is 0
fails:C-API String function rb_str_new2 returns a new string object calling strlen on the passed C string
fails:C-API String function rb_str_new2 encodes the string with ASCII_8BIT
fails:C-API String function rb_str_new creates a new String with ASCII-8BIT Encoding
fails:C-API String function rb_str_new_cstr returns a new string object calling strlen on the passed C string
fails:C-API String function rb_str_new_cstr encodes the string with ASCII_8BIT
fails:C-API String function rb_usascii_str_new creates a new String with US-ASCII Encoding from a char buffer of len characters
fails:C-API String function rb_usascii_str_new_cstr creates a new String with US-ASCII Encoding
fails:C-API String function rb_str_encode returns a String in the destination encoding
fails:C-API String function rb_str_encode transcodes the String
fails:C-API String function rb_str_encode returns a dup of the original String
fails:C-API String function rb_str_encode returns a duplicate of the original when the encoding doesn't change
fails:C-API String function rb_str_encode accepts encoding flags
fails:C-API String function rb_str_encode accepts an encoding options Hash specifying replacement String
fails:C-API String function rb_str_new3 returns a copy of the string
fails:C-API String function rb_str_new4 returns the original string if it is already frozen
fails:C-API String function rb_str_new4 returns a frozen copy of the string
fails:C-API String function rb_str_dup returns a copy of the string
fails:C-API String function rb_str_new5 returns a new string with the same class as the passed string
fails:C-API String function rb_str_append appends a string to another string
fails:C-API String function rb_str_append raises a TypeError trying to append non-String-like object
fails:C-API String function rb_str_append changes Encoding if a string is appended to an empty string
fails:C-API String function rb_str_plus returns a new string from concatenating two other strings
fails:C-API String function rb_str_buf_cat concatenates a C string to a ruby string
fails:C-API String function rb_str_cat concatenates a C string to ruby string
fails:C-API String function rb_str_cat2 concatenates a C string to a ruby string
fails:C-API String function rb_str_cmp returns 0 if two strings are identical
fails:C-API String function rb_str_cmp returns -1 if the first string is shorter than the second
fails:C-API String function rb_str_cmp returns -1 if the first string is lexically less than the second
fails:C-API String function rb_str_cmp returns 1 if the first string is longer than the second
fails:C-API String function rb_str_cmp returns 1 if the first string is lexically greater than the second
fails:C-API String function rb_str_split splits strings over a splitter
fails:C-API String function rb_str2inum converts a string to a number given a base
fails:C-API String function rb_cstr2inum converts a C string to a Fixnum given a base
fails:C-API String function rb_cstr2inum converts a C string to a Bignum given a base
fails:C-API String function rb_cstr2inum converts a C string to a Fixnum non-strictly if base is not 0
fails:C-API String function rb_cstr2inum converts a C string to a Fixnum strictly if base is 0
fails:C-API String function rb_cstr_to_inum converts a C string to a Fixnum given a base
fails:C-API String function rb_cstr_to_inum converts a C string to a Bignum given a base
fails:C-API String function rb_cstr_to_inum converts a C string to a Fixnum non-strictly
fails:C-API String function rb_cstr_to_inum converts a C string to a Fixnum strictly
fails:C-API String function rb_str_subseq returns a byte-indexed substring
fails:C-API String function rb_str_substr returns a substring
fails:C-API String function rb_str_to_str calls #to_str to coerce the value to a String
fails:C-API String function rb_str_to_str raises a TypeError if coercion fails
fails:C-API String function RSTRING_PTR returns a pointer to the string's contents
fails:C-API String function RSTRING_PTR allows changing the characters in the string
fails:C-API String function RSTRING_PTR reflects changes after a rb_funcall
fails:C-API String function RSTRING_PTR returns a pointer to the contents of encoded pointer-sized string
fails:C-API String function RSTRING_LEN returns the size of the string
fails:C-API String function RSTRING_LENINT returns the size of a string
fails:C-API String function StringValue does not call #to_str on a String
fails:C-API String function StringValue does not call #to_s on a String
fails:C-API String function StringValue calls #to_str on non-String objects
fails:C-API String function StringValue does not call #to_s on non-String objects
fails:C-API String function rb_str_resize reduces the size of the string
fails:C-API String function rb_str_resize updates the string's attributes visible in C code
fails:C-API String function rb_str_resize increases the size of the string
fails:C-API String function rb_str_inspect returns the equivalent of calling #inspect on the String
fails:C-API String function rb_str_intern returns a symbol created from the string
fails:C-API String function rb_str_intern returns a symbol even if passed an empty string
fails:C-API String function rb_str_intern returns a symbol even if the passed string contains NULL characters
fails:C-API String function rb_str_freeze freezes the string
fails:C-API String function rb_str_hash hashes the string into a number
fails:C-API String function rb_str_update splices the replacement string into the original at the given location
fails:rb_str_free indicates data for a string might be freed
fails:C-API String function rb_str_length returns the string's length
fails:C-API String function rb_str_length counts characters in multi byte encodings
fails:C-API String function rb_str_equal compares two same strings
fails:C-API String function rb_str_equal compares two different strings
fails:C-API String function rb_external_str_new returns a String in the default external encoding
fails:C-API String function rb_external_str_new returns an ASCII-8BIT encoded string if any non-ascii bytes are present and default external is US-ASCII
fails:C-API String function rb_external_str_new returns a tainted String
fails:C-API String function rb_external_str_new_cstr returns a String in the default external encoding
fails:C-API String function rb_external_str_new_cstr returns an ASCII-8BIT encoded string if any non-ascii bytes are present and default external is US-ASCII
fails:C-API String function rb_external_str_new_cstr returns a tainted String
fails:C-API String function rb_external_str_new_with_enc returns a String in the specified encoding
fails:C-API String function rb_external_str_new_with_enc returns an ASCII-8BIT encoded String if any non-ascii bytes are present and the specified encoding is US-ASCII
fails:C-API String function rb_external_str_new_with_enc transcodes a String to Encoding.default_internal if it is set
fails:C-API String function rb_external_str_new_with_enc returns a tainted String
fails:C-API String function rb_locale_str_new returns a String with 'locale' encoding
fails:C-API String function rb_locale_str_new_cstr returns a String with 'locale' encoding
fails:C-API String function rb_str_conv_enc returns the original String when to encoding is not specified
fails:C-API String function rb_str_conv_enc returns the original String if a transcoding error occurs
fails:C-API String function rb_str_conv_enc returns a transcoded String
fails:C-API String function rb_str_conv_enc when the String encoding is equal to the destination encoding returns the original String
fails:C-API String function rb_str_conv_enc when the String encoding is equal to the destination encoding returns the original String if the destination encoding is ASCII compatible and the String has no high bits set
fails:C-API String function rb_str_conv_enc when the String encoding is equal to the destination encoding returns the origin String if the destination encoding is ASCII-8BIT
fails:C-API String function rb_str_conv_enc_opts returns the original String when to encoding is not specified
fails:C-API String function rb_str_conv_enc_opts returns the original String if a transcoding error occurs
fails:C-API String function rb_str_conv_enc_opts returns a transcoded String
fails:C-API String function rb_str_conv_enc_opts when the String encoding is equal to the destination encoding returns the original String
fails:C-API String function rb_str_conv_enc_opts when the String encoding is equal to the destination encoding returns the original String if the destination encoding is ASCII compatible and the String has no high bits set
fails:C-API String function rb_str_conv_enc_opts when the String encoding is equal to the destination encoding returns the origin String if the destination encoding is ASCII-8BIT
fails:C-API String function rb_str_export returns the original String with the external encoding
fails:C-API String function rb_str_export_locale returns the original String with the locale encoding
fails:C-API String function rb_sprintf replaces the parts like sprintf
fails:C-API String function rb_sprintf accepts multiple arguments
fails:C-API String function rb_vsprintf returns a formatted String from a variable number of arguments
20 changes: 20 additions & 0 deletions spec/truffle/tags/optional/capi/symbol_tags.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
fails:C-API Symbol function rb_intern converts a string to a symbol, uniquely
fails:C-API Symbol function rb_intern2 converts a string to a symbol, uniquely, for a string of given length
fails:C-API Symbol function rb_intern_const converts a string to a Symbol
fails:C-API Symbol function rb_id2name converts a symbol to a C char array
fails:C-API Symbol function rb_id2str converts a symbol to a Ruby string
fails:C-API Symbol function rb_id2str creates a string with the same encoding as the symbol
fails:C-API Symbol function rb_intern_str converts a Ruby String to a Symbol
fails:C-API Symbol function rb_is_const_id returns true given a const-like symbol
fails:C-API Symbol function rb_is_const_id returns false given an ivar-like symbol
fails:C-API Symbol function rb_is_const_id returns false given a cvar-like symbol
fails:C-API Symbol function rb_is_const_id returns false given an undecorated symbol
fails:C-API Symbol function rb_is_instance_id returns false given a const-like symbol
fails:C-API Symbol function rb_is_instance_id returns true given an ivar-like symbol
fails:C-API Symbol function rb_is_instance_id returns false given a cvar-like symbol
fails:C-API Symbol function rb_is_instance_id returns false given an undecorated symbol
fails:C-API Symbol function rb_is_class_id returns false given a const-like symbol
fails:C-API Symbol function rb_is_class_id returns false given an ivar-like symbol
fails:C-API Symbol function rb_is_class_id returns true given a cvar-like symbol
fails:C-API Symbol function rb_is_class_id returns false given an undecorated symbol
fails:C-API Symbol function rb_sym2str converts a Symbol to a String
32 changes: 32 additions & 0 deletions spec/truffle/tags/optional/capi/time_tags.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
fails:CApiTimeSpecs rb_time_new creates a Time from the sec and usec
fails:CApiTimeSpecs TIMET2NUM returns an Integer
fails:CApiTimeSpecs rb_time_nano_new creates a Time from the sec and usec
fails:CApiTimeSpecs rb_time_num_new creates a Time in the local zone with only a timestamp
fails:CApiTimeSpecs rb_time_num_new creates a Time with the given offset
fails:CApiTimeSpecs rb_time_num_new creates a Time with a Float timestamp
fails:CApiTimeSpecs rb_time_num_new creates a Time with a Rational timestamp
fails:CApiTimeSpecs rb_time_interval creates a timeval interval for a Fixnum
fails:CApiTimeSpecs rb_time_interval creates a timeval interval for a Float
fails:CApiTimeSpecs rb_time_interval creates a timeval interval for a Rational
fails:CApiTimeSpecs rb_time_interval throws an argument error for a negative value
fails:CApiTimeSpecs rb_time_interval throws an argument error when given a Time instance
fails:CApiTimeSpecs rb_time_timeval creates a timeval for a Fixnum
fails:CApiTimeSpecs rb_time_timeval creates a timeval for a Float
fails:CApiTimeSpecs rb_time_timeval creates a timeval for a Rational
fails:CApiTimeSpecs rb_time_timeval creates a timeval for a negative Fixnum
fails:CApiTimeSpecs rb_time_timeval creates a timeval for a negative Float
fails:CApiTimeSpecs rb_time_timeval creates a timeval for a negative Rational
fails:CApiTimeSpecs rb_time_timeval creates a timeval from a Time object
fails:CApiTimeSpecs rb_time_timespec creates a timespec for a Fixnum
fails:CApiTimeSpecs rb_time_timespec creates a timespec for a Float
fails:CApiTimeSpecs rb_time_timespec creates a timespec for a Rational
fails:CApiTimeSpecs rb_time_timespec creates a timespec for a negative Fixnum
fails:CApiTimeSpecs rb_time_timespec creates a timespec for a negative Float
fails:CApiTimeSpecs rb_time_timespec creates a timespec for a negative Rational
fails:CApiTimeSpecs rb_time_timespec creates a timespec from a Time object
fails:CApiTimeSpecs rb_time_timespec_new returns a time object with the given timespec and UTC offset
fails:CApiTimeSpecs rb_time_timespec_new returns time object in UTC if offset given equals INT_MAX - 1
fails:CApiTimeSpecs rb_time_timespec_new returns time object in localtime if offset given equals INT_MAX
fails:CApiTimeSpecs rb_time_timespec_new raises an ArgumentError if offset passed is not within range of -86400 and 86400 (exclusive)
fails:CApiTimeSpecs rb_time_timespec_new when offset given is within range of -86400 and 86400 (exclusive) sets time's is_gmt to false
fails:CApiTimeSpecs rb_time_timespec_new when offset given is within range of -86400 and 86400 (exclusive) sets time's offset to the offset given
28 changes: 28 additions & 0 deletions spec/truffle/tags/optional/capi/util_tags.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
fails:C-API Util function returns the C int value
fails:C-API Util function rb_scan_args assigns the required arguments scanned
fails:C-API Util function rb_scan_args raises an ArgumentError if there are insufficient arguments
fails:C-API Util function rb_scan_args assigns the required and optional arguments scanned
fails:C-API Util function rb_scan_args assigns the optional arguments scanned
fails:C-API Util function rb_scan_args assigns nil for optional arguments that are not present
fails:C-API Util function rb_scan_args assigns the required and optional arguments and splats the rest
fails:C-API Util function rb_scan_args assigns the required and optional arguments and and empty Array when there are no arguments to splat
fails:C-API Util function rb_scan_args assigns required, optional arguments scanned and the passed block
fails:C-API Util function rb_scan_args assigns required, optional, splatted arguments scanned and the passed block
fails:C-API Util function rb_scan_args assigns required arguments, nil for missing optional arguments and the passed block
fails:C-API Util function rb_scan_args assigns required, splatted arguments and the passed block
fails:C-API Util function rb_scan_args assigns post-splat arguments
fails:C-API Util function rb_scan_args assigns required, optional, splat and post-splat arguments
fails:C-API Util function rb_scan_args assigns required, splat, post-splat arguments
fails:C-API Util function rb_scan_args assigns optional, splat, post-splat arguments
fails:C-API Util function rb_scan_args assigns required, optional, splat, post-splat and block arguments
fails:C-API Util function rb_scan_args assigns Hash arguments
fails:C-API Util function rb_scan_args assigns required and Hash arguments
fails:C-API Util function rb_scan_args assigns required, optional, splat, post-splat, Hash and block arguments
fails:C-API Util function rb_scan_args rejects non-keyword arguments
fails:C-API Util function rb_scan_args rejects required and non-keyword arguments
fails:C-API Util function rb_scan_args considers the hash as a post argument when there is a splat
fails:C-API Util function rb_long2int raises a RangeError if the value is outside the range of a C int
fails:C-API Util function rb_iter_break breaks a loop
fails:C-API Util function rb_iter_break breaks the inner loop
fails:C-API Util function rb_sourcefile returns the current ruby file
fails:C-API Util function rb_sourceline returns the current ruby file
27 changes: 26 additions & 1 deletion spec/truffle/truffle.mspec
Original file line number Diff line number Diff line change
@@ -17,7 +17,31 @@ class MSpecScript
end

set :capi, [
"spec/ruby/optional/capi"
"spec/ruby/optional/capi",

# Incorrect C code for spec?
"^spec/ruby/optional/capi/data_spec.rb",

# Requires 'ruby/encoding.h'
"^spec/ruby/optional/capi/encoding_spec.rb",

# Requires 'ruby/io.h'
"^spec/ruby/optional/capi/io_spec.rb",

# Incorrect C code for spec?
"^spec/ruby/optional/capi/proc_spec.rb",

# Requires 'ruby/re.h'
"^spec/ruby/optional/capi/regexp_spec.rb",

# Requires 'ruby/intern.h'
"^spec/ruby/optional/capi/struct_spec.rb",

# Requires 'ruby/thread.h'
"^spec/ruby/optional/capi/thread_spec.rb",

# Missing symbol @Init_typed_data_spec.
"^spec/ruby/optional/capi/typed_data_spec.rb"
]

set :command_line, [
@@ -79,6 +103,7 @@ class MSpecScript
[%r(^.*/language/), 'spec/truffle/tags/language/'],
[%r(^.*/core/), 'spec/truffle/tags/core/'],
[%r(^.*/library/), 'spec/truffle/tags/library/'],
[%r(^.*/optional/capi/), 'spec/truffle/tags/optional/capi/'],
[%r(^.*/truffle/specs/truffle), 'spec/truffle/tags/truffle/'],
[/_spec.rb$/, '_tags.txt']
]
4 changes: 4 additions & 0 deletions truffle/src/main/c/cext/ruby.c
Original file line number Diff line number Diff line change
@@ -201,6 +201,10 @@ void rb_raise(VALUE exception, const char *format, ...) {
truffle_invoke(RUBY_CEXT, "rb_raise", format /*, where to get args? */);
}

VALUE rb_define_class(const char *name, VALUE superclass) {
return truffle_invoke(RUBY_CEXT, "rb_define_class", truffle_read_string(name), superclass);
}

VALUE rb_define_module(const char *name) {
return truffle_invoke(RUBY_CEXT, "rb_define_module", truffle_read_string(name));
}
12 changes: 10 additions & 2 deletions truffle/src/main/ruby/core/truffle/cext.rb
Original file line number Diff line number Diff line change
@@ -25,7 +25,7 @@ def Qtrue
def Qnil
nil
end

def rb_cObject
Object
end
@@ -101,7 +101,15 @@ def rb_scan_args
def rb_raise(object, name)
raise 'not implemented'
end


def rb_define_class(name, superclass)
#raise 'not implemented'

# Return nil instead of raising an exception so the C API specs get far enough along to tag them.
# This implementation is clearly not correct.
nil
end

def rb_define_module(name)
Object.const_set(name, Module.new)
end

0 comments on commit 35afc2c

Please sign in to comment.