sup

A curses threads-with-tags style email client

sup.git

git clone https://supmua.dev/git/sup/
commit ac82b2890971323ec4220aad429f1240745cfe80
parent 66e183c5d7a1c12f118505bc6d48dd52492179cd
Author: Whyme Lyu <callme5long@gmail.com>
Date:   Sat, 20 Apr 2013 19:17:08 +0200

Merge #16: Fix YAML regression in 1.9

Squashed commit of the following:

commit a26b99c64e2da4115ea47606ae8b66f0b008b002
Author: Whyme Lyu 
Date:   Tue Mar 26 23:03:50 2013 +0800

    Ensure Syck is used.

    In the long run we'd better drop Syck in favor of Psych

commit a99a2b244063c2088d91688f667ee68f05f24df0
Author: Whyme Lyu 
Date:   Tue Mar 26 23:03:25 2013 +0800

    A regression test for YAMLing in 1.9

Diffstat:
M bin/sup-config | 1 -
M lib/sup.rb | 3 +++
A test/test_yaml_regressions.rb | 17 +++++++++++++++++
3 files changed, 20 insertions(+), 1 deletion(-)
diff --git a/bin/sup-config b/bin/sup-config
@@ -2,7 +2,6 @@
 
 require 'rubygems'
 require 'highline/import'
-require 'yaml'
 require 'trollop'
 require "sup"
 
diff --git a/lib/sup.rb b/lib/sup.rb
@@ -1,6 +1,9 @@
 require 'rubygems'
+
 require 'syck'
 require 'yaml'
+YAML::ENGINE.yamler = 'syck'
+
 require 'zlib'
 require 'thread'
 require 'fileutils'
diff --git a/test/test_yaml_regressions.rb b/test/test_yaml_regressions.rb
@@ -0,0 +1,17 @@
+require 'test/unit'
+
+# Requiring 'yaml' before 'sup' in 1.9.x would get Psych loaded first
+# and becoming the default yamler.
+require 'yaml'
+require 'sup'
+
+module Redwood
+  class TestYamlRegressions < Test::Unit::TestCase
+    def test_yamling_hash
+      hsh = {:foo => 42}
+      reloaded = YAML.load(hsh.to_yaml)
+
+      assert_equal reloaded, hsh
+    end
+  end
+end