é·ãã¨æãã®ã§çµæã ã
ãªãã¸ããªã¯ãã¡ãã
使ãæ¹ã¯git clone
ãã¦make
ããã ãã¨å¤§å¤ãæ軽ã
make TESTS="core/nil"
ã®ããã«ããã£ã¬ã¯ããªæå®ããã¡ã¤ã«åæå®ãã§ããã
å ¨å½ã®mrubyistã®çæ§ã«æ¼ããã¾ãã¦ã¯ãæ¯éã試ãé¡ãããã¨ããã§ãã
以ä¸ã¤ãã¤ãã¨
ã¢ããã¼ã·ã§ã³
æ°å¹´åã«å§ãã¦ããã¨ãããã®ãmrubyã¨ããè¹ã«ä¹ãããã£ãããã«ã¯ãmrubyã«ã¯ãããªããã¨ããmrubyã¯ãã°ãå¤ããã¨ãè¨ãããããªããã¨æããããã«ã¯æçã¨ããã責任æãåæã«æã£ã¦ããã
ãmrubyã¯CRubyã¨åä½ãéããã¨ããã®ã¯ãããã話ãªã®ã ããããã極åæ¸ããããã(å®å ¨ã«ã¯ç¡çã ãã©)
ä»æ§ãåããªãCRubyã®ç¥èããã®ã¾ã¾mrubyã«ä½¿ããããããã¥ã¡ã³ããCRubyã®ãã®ããã®ã¾ã¾ä½¿ããã ãCRubyã®ã©ã¤ãã©ãªãmrubyã«ç§»æ¤ãã¨ããã®ãè¡ãããããªã£ã¦ããã ååã®ããã°ã§æ¸ãããmrubyã§ãCRubyã§ãåãgemããªãã¦ããé¢ãæ¥ãå¯è½ã«ãªãã
ãããªããã§ãmrubyã®ç´°ããæåãCRubyã«åããããã¨ããæ´»åã¯ã¡ãªãããããã¨ä¿¡ãã¦çµæ§ãã£ã¦ããã¤ãããªãã ãã©ãç´°ããä»æ§ã¯çµæ§CRubyã®ãã¹ããruby/specãèªã¾ãªãã¨ããããªãã£ãããããã¨ãå¤ãã£ãã
ãã誰ã§ãmrubyã§ruby/specã®ãã§ãã¯ãã§ãããªããã©ãã©ãmrubyããããªã£ã¦ããã«éããªãã¨æãããã£ã¦ã¿ããã§ãããã¨ããæãã
ruby/spec
ruby/spec ã¨ã¯æ§ã ã«åå¨ããRubyå¦çç³»ã«ããã¦ããã®æåãçµ±ä¸ããããã«ä½ããããã®ã ãRubyã§ãããããã§ãã¯ãããã¹ãã±ã¼ã¹éã (è¦åºå ¸)ã
ãmrubyã§ruby/specãèµ°ãããã
ãã®ãã¯ã¼ã¯ã¼ããå®è¡ã«ç§»ããããä½å¹´ãåã«è©¦ããæã¯è¶ ããªããã°ãããªãå±±ãå¤ããã¦æ«æããã ããããããæ°å¹´ã§mrubyçéãçãä¸ããææãæã£ã¦ããæ°ãããã®ã§å度ææ¦ãã¦ã¿ããã§ããã
éä¸ã§ã¶ã¤ãã£ãæ§ã ãªé害ãç´¹ä»ããã
mrubyã§ruby/specãèµ°ãããããã«å¿ è¦ãªãã®ãã¡
ãRubyã§ãããã¨ããä»æ§ãã§ãã¯ãããã®ãruby/specãªããã ãã©ãå®ã¯ãã®ruby/specãèµ°ãããããã«ããããç¨åº¦ãRubyãã§ãªãã¦ã¯åããªãã
ä»åã¯ä»¥ä¸ã®ããç¨åº¦ã解æ¶ããã
æ§æ
"a" "b" #=> "ab"
ã®ãããªæååãªãã©ã«ã®é£çµã¯ã§ããªãã(mrubyããªããããã¦ãããã¯ããããªã)defined?
ã使ããªããhttps://github.com/mruby/mruby/issues/1696 ã«ããã¨ãå®è£ ãã¡ããã¨mrubyã大ããè¤éã«ãªã£ã¦ãã¾ããObject.const_defined?
ã§ã ããããªãã¨ããªãã¨ããçç±ã®ããã ã
ruby/specããã¹ãã±ã¼ã¹éã¨ããã°ããã®ã©ã³ãã¼ã¨ãªãã®ãruby/mspecã ruby/specãèµ°ãããã¨ããã®ã¯ãæ£ç¢ºã«ã¯ruby/mspecãèµ°ãããã¨å義ã ã
ãã®æ§æã®åé¡ãruby/mspecã«ãã£ãã
æ§æã®åé¡ã¯ã¨ããããruby/mspecãforkãã¦åé¡ã®é¨åãæ¸ãæãããã¨ã§è§£æ¶ããã¦ããã åé¡ã®é¨åãã¾ã¨ã¾ã£ããmruby対å¿PRã¨ãã¦patchãæãããã¨æãã
ã©ã¤ãã©ãª
mrubyã§ã¯OSã®æ©è½ã使ãé¨åã¯coreã«å ¥ã£ã¦ããªãã ãã®ããããå¤é¨gemã¨ãã¦ç¨æããã°ããã©ã°ã¤ã³çã«mrubyãæ¡å¼µã§ããã ruby/mspecãèµ°ãããããã«ã¯ä»¥ä¸ã®åé¡ããããããããã©ã¤ãã©ãªã«ãã£ã¦è§£æ¶ã§ããã
ENV
ã使ããªã- CRubyã®ããã«ç°å¢å¤æ°ãæ±ãã iij/mruby-env ã§è§£æ¶ã
Dir.[]
ã使ããªãDir.glob
ãå®è£ ãã¦ãã gromnitsky/mruby-dir-glob ã使ç¨ã- å¾è¿°ããéãªpatchã§
alias [] glob
ã¨ãããã¨ã§è§£æ¶ã Dir.glob
ã¯å®è£ ãè¤éããã ã£ãã®ã§é常ã«å©ãã£ãã
File
ãIO
ã使ããªã- mrubyçéã®ããã¡ã¯ãã¹ã¿ã³ãã¼ã iij/mruby-ioã使ç¨ã
Signal
ãtrap
ã使ããªã- ã¯ã¼ ã³ã³ã ã¡ã³ãã¯ãµã½ã¦ã ã©ã¤ãã©ãªã¼ ã¹ããã¢ãã¿ã¯ã¼ ksss/mruby-signalã使ç¨ã
Thread
ã使ããªã- "Threadãã¨ã«mrb_stateãä½ã£ã¦å®å
¨ã«åé¢ãã"ã¨ããè¨è¨ææ³ä¸CRubyã®
Thread
ã¨ä»æ§ã¯ç°ãªããããããªã«ç¥èãå¿ è¦ãããªãã®ã¯ãªããªãä½ãã®ãé£ããããªã®ã§ mattn/mruby-thread ãããããã使ç¨ã
- "Threadãã¨ã«mrb_stateãä½ã£ã¦å®å
¨ã«åé¢ãã"ã¨ããè¨è¨ææ³ä¸CRubyã®
File.executable?
ã使ããªãã- æå¤ãªä¼å µã ã£ããã便å©ãããªãã®ããã£ãã®ã§ ksss/mruby-file-stat ã使ç¨ã
- ããã使ã£ã¦ã¡ã½ããã追å ãããã¨ã§
File.executable?
ã¯å®è£ ã§ãããmruby-file-statã§File.executable?
ã¯å®è£ ãããæ©ã¿ä¸ããã
Process
ã使ããªãã- ããã¾ã(åãåæã«)mrubyçã®ããã¡ã¯ãã¹ã¿ã³ãã¼ã(ã¨å¼ãã§ãã) iij/mruby-process ã使ç¨ã
at_exit
ã使ããªãã- å®ã¯ãã®åé¡ã解決ããããã« ksss/mruby-at_exit ã¯ç£ã¾ããã®ã ã£ãã
Regexp
ã¨ãããæ£è¦è¡¨ç¾ã使ããªãã- ã»ã¨ãã©ã®mrubyã¢ããªã«ã¯ãããå ¥ã£ã¦ããããããªãã ãããã mattn/mruby-onig-regexpã使ç¨ã
Object#pretty_print
ã使ããªã- CRubyã§ã¯
require 'pp'
ããã°ä½¿ãããã¤ã - mruby-ppã®å®è£ ã¯2ã¤ãã£ãã®ã§æ©ãã ããkou/mruby-ppãé¸æã takahashim/mruby-ppã§ãåä½ã¯å¤ãããªãã¨æãã
- CRubyã§ã¯
require
ã使ããªã- mattn/mruby-requireã§ã»ã¨ãã©ã®åé¡ã¯è§£æ±ºããããã³ã¼ãã¼ã±ã¼ã¹ã§CRubyã¨éäºææ§ããã£ãã®ã§ãã¨ããããforkã使ç¨ä¸ãããã¯åé¡ç¹ãæ´çãã¦patchãæãããã¨æãã
undefined method 'method'
- mrubyã§Method, UnboundMethod classãã¤ãããã¨ããç¥ãããçã«ä¾¿å©ãª ksss/mruby-method ã使ç¨ã
ããã
ããããå²ãã¨æ³¥èãã
ã¾ãruby/mspecãå¿
è¦ã¨ãã¦ããæ¨æºã©ã¤ãã©ãªã¯rbconfig
ã¨pp
ã¨iconv
ã®ã¿ã§ãããããrequire
æãruby/mspecã«æ¸ããã¦ããã
mattn/mruby-requireã§ã¯ãbuild_config.rb
ã«æ¸ããé çªã«ãã£ã¦ãmruby-require
以éã«æ¸ããã¢ã¸ã¥ã¼ã«ã«ã¤ãã¦ã¯å
±æã©ã¤ãã©ãªãä½æãã¦require
ã§ã¢ã¸ã¥ã¼ã«åãæå®ããã¨èªã¿è¾¼ããã¨ããã¦ãã¼ã¯ãªæ©è½ãããã
ãããå©ç¨ãã¦ãã¡ã¤ã«åãå¤ãããªã©ããã°ãrequire 'rbconfig'
ãå®è¡å¯è½ã ããrbconfigã£ã½ããã®ãä½ããã¨æãã°ä½ããã ããã
ããããªãããåé¡ã¯rbconfigã ãã§ã¯ãªãã以ä¸ã®è¿½å ããããå¿ è¦ã¨ãªãã
File.executable?
Dir.[]
SystemExit
RUBY_PLATFORM
RUBY_PATCHLEVEL
$:
ã®èª¿æ´Kernel#abort
å®ã¯require 'rbconfig'
ã¯ããªãã¯ããã®æ¹ã«å®è¡ããããããrbconfigã¢ã¸ã¥ã¼ã«ãæ¸ããããrbconfig.rb
ã¨ãããã¡ã¤ã«ãä½ã£ã¦ãããç½®ãå ´ã«ããã»ãã便å©ãªã®ã ã
ãã®çç±ã«ãããrbconfig.rb
ã¯ããã¤ã¯ruby/mspecãèµ°ãããããã®ç´°ãããããç½®ãå ´ã¨ãªã£ã¦ããã
ä»ã®ppã¨iconvã¯ããããpp.rb
ã¨iconv.rb
ã¨ãã空ã®ãã¡ã¤ã«ãä½ã£ã¦ããã¦ããã¼ãããããã¹ã«ç½®ããã¨ã§åé¿ãã¦ããã(iconvãå¿
è¦ãªå ´é¢ã«ã¾ã ééãã¦ããªãã ãã§ãééããããªã«ãèããªãã¨ãããªã)
ããããmrubyã®Integerã®ç¯å²ã®ããã©ã«ãã¯32bitæ³å®ã¨ãªã£ã¦ãããããæ§ã
ãªspecã§æ³å®ä»¥ä¸ã®æ°åã使ãããã¨æååçæãªã©ã§ArgumentError: string (10204000000) too big for integer
ã¨è¡¨ç¤ºããããããã®ã§ã64bitæ³å®ã¨ãªãããã«mrbconf.h
ã調æ´ããããã¦ããã
ã¡ãªãã
mrubyã®ã¢ã¸ã¥ã¼ã«ã®ãã¡CRubyã¨åãAPIãæã¤ãã®ã«ã¤ãã¦(ãããã¯åãåä½ãæå¾ ãããã®ã«ã¤ãã¦)ãCRubyã¨ã®éäºææ§ãç°¡åã«ãã§ãã¯ã§ããã
å®éã«mruby-signalã§ããmake TESTS="core/signal"
ã¨ããã ãã§éäºææ§ãçºè¦ã§ããã®ã§ã
7 failuresã2 failuresã«æ¸ãããã¨ãã§ããã
ããããããã³ãã³ä¿®æ£ãã¦ããã¤ããã ãããã誰ã§ãå®è¡ã§ããã®ã§ãã³ãã³mrubyçéããããªã£ã¦ããã
ãã¡ãªãã
ä»æ§ãåããããã¨ã®ãã¡ãªãããç解ãã¦ããã
ããããä¸é¨ã®æ©è½ã®ããã«å ¨ä½ã®ããã©ã¼ãã³ã¹ãã¡ã³ããã³ã¹æ§ãç ç²ã«ããªããã°ãªããªããªãã¨ããã®ã¯ããããã話ã
ãã®å ´åã¯ã¡ãªããã»ãã¡ãªããã®ãã¬ã¼ããªããã³ãã³ãåã¡ã³ããããã£ã¦ãããããªãããããªãã ããããªãã
ããããªããè°è«ããããã¨èªä½ã¯æçãªã¯ãã ããæ°ã«ãããã£ã¦ããã¨ããããããªãã§ããããã
ãããªãããªã§
ãã¾ãã¾ãªã¢ã¸ã¥ã¼ã«ã®å©ããåãã¤ã¤ãã¤ãã«ruby/specãmrubyã§èµ°ããããã¨ã«æåããã¨ããããã§ããæè¬ã
å®éã«å®è¡ãã¦ã¿ãã¨ããã£ããã£ãã¨specãè½ã¡ã¾ããã
大æµããclassããªãã¨ããmethodããªãã¨ãã ã
Encodingãªã©ã®mrubyã§ã¯å®è£
ããã¦ããªãæ©è½ã¯ãããããªãã¨ãã¦ã
$ make TESTS="language"
ã§ã¯ã©ã³ãã ã«Segmentation faultããã
ããã°ã£ã¦mrubyããããã¦ããããã
ã¨ãããä¸äººã§ã¯å®å ¨ã«ç¡çã
ä¸ç·ã«ããã°ã£ã¦ããã¾ãããï¼