swig/Examples/test-suite/ruby/char_constant_runme.rb
Klaus Kämpf 9e2c35f766 Make string encoding explitic
Ruby 2.0 enforces explicit string encodings. The char_constant
testcase fails because the internal (SWIG_FromCharPtrAndSize, using
rb_str_new) defaults to ASCII-8BIT while the test-suite file defaults
to the current shell LOCALE setting.

This patch sets the char_constant_runme.rb encoding to ASCII-8BIT.
2013-11-29 14:02:51 +01:00

34 lines
640 B
Ruby

#!/usr/bin/env ruby
#Encoding: ASCII-8BIT
# Put description here
#
#
#
#
#
require 'swig_assert'
require 'char_constant'
if Char_constant::CHAR_CONSTANT != 'x'
raise RuntimeError, "Invalid value for CHAR_CONSTANT."
end
if Char_constant::STRING_CONSTANT != 'xyzzy'
raise RuntimeError, "Invalid value for STRING_CONSTANT."
end
if Char_constant::ESC_CONST != "\001"
raise RuntimeError, "Invalid value for ESC_CONST."
end
if Char_constant::NULL_CONST != "\000"
raise RuntimeError, "Invalid value for NULL_CONST."
end
if Char_constant::SPECIALCHAR != "\341" #'á'
raise RuntimeError, "Invalid value for SPECIALCHAR."
end